【uView】u-action-sheet 操作菜单

ActionSheet 操作菜单

拨打电话



export default {
  data() {
    return {
      show: false,
      list: []
    };
  },
  onShow() {
    this.init();
  },
  methods: {
    init() {
      getData(`/getList`, {}).then((res) => {
        const { code, data } = res;
        if (code == 200) {
          this.phone = data.value
          this.list = [
            {
              name: '客服电话',
              subname: phone,
              index: 0,
            },
            {
              name: '拨打电话',
              phone: phone,
              index: 1,
            },
            {
              name: '取消',
              index: 2,
            }
          ]
        }
      });
    },
    client() {
      this.show = true
    },
    selectClick(e) {
      if (e.index == 1) {
        uni.makePhoneCall({
          phoneNumber: e.phone
        }).catch((e) => { })
      }
      if (e.index == 2) {
        this.show = false
      }
    },
  },
};

你可能感兴趣的:(uni-app,uni-app)