-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.wpy
61 lines (51 loc) · 1.15 KB
/
example.wpy
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
<style>
button {
margin-top: 100px;
}
button + button {
margin-top: 10px;
}
</style>
<template>
<view class="container">
测试toast
<button @tap="showSuccessTip">成功提示</button>
<button @tap="showErrorTip">错误提示</button>
<button @tap="showInfoTip">提醒提示</button>
<button @tap="showWarningTip">警告提示</button>
<toast/>
</view>
</template>
<script>
import wepy from 'wepy'
import toast from 'wepy-simple-toast'
export default class extends wepy.page {
config = {
navigationBarTitleText: 'simple-toast'
}
components = {
toast
}
mixins = [toast.mixin]
data = {}
methods = {
showSuccessTip() {
this.$invoke('toast', 'success', 'simple-toast success')
},
async showErrorTip() {
let data = await this.$invoke('toast', 'error', 'simple-toast error', { duration: 5000 })
console.log(data)
},
showInfoTip() {
this.$infoTip('simple-toast info', { duration: 5000 }).then(data => {
console.log(data)
})
},
showWarningTip() {
this.$warningTip('simple-toast warning', { duration: 3000 })
}
}
onLoad() {
}
}
</script>