小程秀里面的一段代码的code

module.exports = {
    showToast: function(n) {
        return new Promise(function(o, t) {
            wx.showToast({
                title: n.title,
                icon: n.icon || "none",
                image: n.image,
                duration: n.duration || 2e3,
                mask: n.mask || !1,code
                success: function() {
                    o();
                },
                fail: function() {
                    t();
                }
            });
        });
    },
    showLoading: function(n) {
        return new Promise(function(o, t) {
            wx.showLoading({
                title: n.title,
                mask: n.mask,
                success: function() {
                    o();
                },
                fail: function() {
                    t();
                }
            });
        });
    },
    hideToast: function() {
        return new Promise(function(n, o) {
            wx.hideToast(), n();
        });
    },
    hideLoading: function() {
        return new Promise(function(n, o) {
            wx.hideLoading(), n();
        });
    },
    showModal: function(n) {
        return new Promise(function(o, t) {
            wx.showModal({
                title: n.title || "",
                content: n.content || "",
                showCancel: n.showCancel || !1,
                cancelText: n.cancelText || "取消",
                cancelColor: n.cancelColor || "#202020",
                confirmText: n.confirmText || "确定",
                confirmColor: n.confirmColor || "#0084ff",
                success: function(n) {
                    o({
                        confirm: n.confirm,
                        cancel: n.cancel
                    });
                },
                fail: function(n) {
                    t(n);
                }
            });
        });
    },
    showActionSheet: function(n) {
        return new Promise(function(o, t) {
            wx.showActionSheet({
                itemList: n.itemList,
                itemColor: n.itemColor,
                success: function(n) {
                    o({
                        tapIndex: n.tapIndex
                    });
                },
                fail: function() {
                    t();
                }
            });
        });
    }
};



在做微信小程序的时候 打开js 包看代码的时候里面有个code 关键字,找到后是在export 模块里面但是里面有个code 不知道怎么来的不知道这个语法啥意思,求人指教,谢谢

  就在这行代码(mask: n.mask || !1,code)
  
  请问这个是什么意思?有人知道吗?

阅读 1.6k
1 个回答

code应该是个全局变量,那行代码其实是这样:

{
     duration: n.duration || 2e3,
     mask: n.mask || !1,
     code:code
}

可以直接写code,糖语法。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题