Popup.js 1.38 KB
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
Component({
  externalClasses: ["popup-slot-class"],
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false,
      observer: function (n, o) {
        n && wx.hideKeyboard();
        this.setData({
          showPopup: n,
        });
      },
    },
    title: String,
    height: {
      type: String,
      value: "85%",
    },
    slotStyle: String,
    cancelText: String,
    cancelStyle: String,
    confirmText: {
      type: String,
      value: "确认",
    },
    confirmStyle: String,
    singleButton: {
      type: Boolean,
      value: false,
      observer: function (newVal) {
        // 确保 singleButton 是布尔值
        if (typeof newVal !== "boolean") {
          this.setData({
            singleButton: newVal === true || newVal === "true",
          });
        }
      },
    },
  },

  /**
   * 组件的初始数据
   */
  data: {},

  /**
   * 组件的方法列表
   */
  methods: {
    noScroll() {},
    hidePopup() {
      this.setData({
        show: false,
      });
      this.triggerEvent("cancel");
    },
    confirm() {
      this.triggerEvent("confirm");
    },
  },
  attached() {
    // console.log(wx.$util.isFullSucreen(), 'wx.$util.isFullSucreen()')
    this.setData({
      isFullSucreen: wx.$util.isFullSucreen(true),
    });
  },
});