WXL
11 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
  name: "UniDrawer",
  components: {},
  emits: ["change"],
  props: {
    /**
     * 显示模式(左、右),只在初始化生效
     */
    mode: {
      type: String,
      default: ""
    },
    /**
     * 蒙层显示状态
     */
    mask: {
      type: Boolean,
      default: true
    },
    /**
     * 遮罩是否可点击关闭
     */
    maskClick: {
      type: Boolean,
      default: true
    },
    /**
     * 抽屉宽度
     */
    width: {
      type: Number,
      default: 220
    }
  },
  data() {
    return {
      visibleSync: false,
      showDrawer: false,
      rightMode: false,
      watchTimer: null,
      drawerWidth: 220
    };
  },
  created() {
    this.drawerWidth = this.width;
    this.rightMode = this.mode === "right";
  },
  methods: {
    clear() {
    },
    close(type) {
      if (type === "mask" && !this.maskClick || !this.visibleSync)
        return;
      this._change("showDrawer", "visibleSync", false);
    },
    open() {
      if (this.visibleSync)
        return;
      this._change("visibleSync", "showDrawer", true);
    },
    _change(param1, param2, status) {
      this[param1] = status;
      if (this.watchTimer) {
        clearTimeout(this.watchTimer);
      }
      this.watchTimer = setTimeout(() => {
        this[param2] = status;
        this.$emit("change", status);
      }, status ? 50 : 300);
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: $data.visibleSync
  }, $data.visibleSync ? {
    b: $data.showDrawer && $props.mask ? 1 : "",
    c: common_vendor.o(($event) => $options.close("mask")),
    d: $data.rightMode ? 1 : "",
    e: !$data.rightMode ? 1 : "",
    f: $data.showDrawer ? 1 : "",
    g: $data.drawerWidth + "px",
    h: $data.showDrawer ? 1 : "",
    i: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
    j: common_vendor.gei(_ctx, "")
  } : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-183a7e94"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-drawer/uni-drawer.js.map