xcx/components/tips/tips.js

(完整代码) 876B

let timer;
Component({
  externalClasses: ['tui-tips-class'],
  properties: {
    //top bottom center
    position: {
      type: String,
      value: "top"
    }
  },
  data: {
    show: false,
    msg: "无法连接到服务器~",
    //translucent,primary,green,warning,danger
    type: "translucent"
  },
  lifetimes: {
    detached: function() {
      clearTimeout(timer);
      timer = null;
    }
  },
  methods: {
    showTips: function(options) {
      const {type = 'translucent', duration = 2000} = options;
      clearTimeout(timer);
      this.setData({
        show: true,
        type: type,
        msg: options.msg
      }, () => {
        timer = setTimeout(() => {
          this.setData({
            show: false
          }, () => {
            timer = null;
          })
        }, duration)
      })
    }
  }
})

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。