// pages/component/kefu/index.js import commonApi from "../../../utils/https/common.js" Component({ /** * 组件的属性列表 */ properties: { }, data: { show: false, showPhone: false, info: "", phones: [] }, lifetimes: { attached() { console.log('组件已挂载到页面'); this.initData(); } }, /** * 组件的初始数据 */ /** * 组件的方法列表 */ methods: { initData () { commonApi._post("kefu_tips/getTips", {platform:'miniapp'}).then(res=>{ if (res.data) { this.setData({ showPhone: res.data.is_online, info: res.data.content, phones: res.data.emergency_phones }) } }) }, hideModal: function () { this.setData({ show: false, }) this.triggerEvent('hideModal'); }, phoneCall:function(e){ let phone = e.currentTarget.dataset.phone; wx.makePhoneCall({ phoneNumber: phone, }) }, } })