xcx/components/extend/toast/toast.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

let timer;
Page({
  properties: {},
  data: {
    //是否显示
    visible: false,
    //显示标题
    title: "操作成功",
    //显示内容
    content: "",
    //是否有icon
    icon: false,
    imgUrl: ""
  },
  lifetimes: {
    detached: function () {
      clearTimeout(timer);
      timer = null;
    }
  },
  methods: {
    // show: function (options) {
    //   let {
    //     duration = 2000,
    //     icon = false
    //   } = options;
    //   clearTimeout(timer);
    //   if (icon && options.imgUrl) {
    //     this.setData({
    //       imgUrl: options.imgUrl
    //     })
    //   }
    //   this.setData({
    //     visible: true,
    //     title: options.title || "",
    //     content: options.content || "",
    //     icon: icon
    //   })
    //   timer = setTimeout(() => {
    //     this.setData({
    //       visible: false
    //     }, () => {
    //       timer = null;
    //     })
    //   }, duration)
    // }
  },
  show: function (options) {
    let {
      duration = 2000,
      icon = false
    } = options;
    clearTimeout(timer);
    if (icon && options.imgUrl) {
      this.setData({
        imgUrl: options.imgUrl
      })
    }
    this.setData({
      visible: true,
后面还有 14 行代码,购买后查看完整代码

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

AI 解读 AI

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

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