Blame view

node_modules/mpvue-zanui/src/pages/zan_toast/index.vue 1.88 KB
ce4c83ff   wxy   初始提交
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
  <template>
    <div class="container">
  
      <div class="doc-title zan-hairline--bottom">TOAST</div>
  
      <div class="zan-btns" style="margin-top: 15vh;">
        <button class="zan-btn" @click="showToast">
          显示toast
        </button>
  
        <button class="zan-btn" @click="showIconToast">
          显示 Icon 图标的toast
        </button>
  
        <button class="zan-btn" @click="showImageToast">
          自定义图片作为图标的toast
        </button>
  
        <button class="zan-btn" @click="showLoadingToast">
          显示 Loading toast
        </button>
  
        <button class="zan-btn" @click="showOnlyIcon">
          只显示图标的toast
        </button>
  
        <button class="zan-btn" @click="showLoading">
          显示 Loading
        </button>
      </div>
  
      <_toast />
    </div>
  </template>
  
  <script>
    import { getComponentByTag } from '../../utils/helper'
    import ZanToast from '../../components/zan/toast'
    export default {
      components: {
        _toast: ZanToast
      },
      data  () {
        return {
        }
      },
      mounted () {
        this.toast = getComponentByTag(this, '_toast')
      },
      methods: {
        showToast () {
          this.toast.showZanToast('toast的内容')
        },
  
        showIconToast () {
          this.toast.showZanToast({
            title: 'toast的内容',
            icon: 'fail'
          })
        },
  
        showImageToast () {
          this.toast.showZanToast({
            title: 'toast的内容',
            image: 'https://b.yzcdn.cn/v2/image/dashboard/secured_transaction/suc_green@2x.png'
          })
        },
  
        showLoadingToast () {
          this.toast.showZanToast({
            title: 'toast的内容',
            icon: 'loading'
          })
        },
  
        showOnlyIcon () {
          this.toast.showZanToast({
            icon: 'fail'
          })
        },
  
        showLoading () {
          this.toast.showZanLoading('加载中')
        }
      }
    }
  </script>
  <style  scoped >
  </style>