|
1 | 1 | <template> |
2 | | - <view> |
3 | | - <page-head :title="title"></page-head> |
4 | | - <view class="uni-padding-wrap uni-common-mt"> |
5 | | - <button type="primary">页面主操作 Normal</button> |
6 | | - <button type="primary" loading="true">页面主操作 Loading</button> |
7 | | - <button type="primary" disabled="true">页面主操作 Disabled</button> |
8 | | - |
9 | | - <button type="default">页面次要操作 Normal</button> |
10 | | - <button type="default" disabled="true">页面次要操作 Disabled</button> |
11 | | - |
12 | | - <button type="warn">警告类操作 Normal</button> |
13 | | - <button type="warn" disabled="true">警告类操作 Disabled</button> |
14 | | - |
15 | | - <view class="button-sp-area"> |
16 | | - <button type="primary" plain="true">按钮</button> |
17 | | - <button type="primary" disabled="true" plain="true">不可点击的按钮</button> |
18 | | - |
19 | | - <button type="default" plain="true">按钮</button> |
20 | | - <button type="default" disabled="true" plain="true">按钮</button> |
21 | | - |
22 | | - <button class="mini-btn" type="primary" size="mini">按钮</button> |
23 | | - <button class="mini-btn" type="default" size="mini">按钮</button> |
24 | | - <button class="mini-btn" type="warn" size="mini">按钮</button> |
25 | | - </view> |
26 | | - <!-- #ifdef MP-WEIXIN || MP-QQ --> |
27 | | - <button open-type="launchApp" app-parameter="uni-app" @error="openTypeError">打开APP</button> |
28 | | - <button open-type="feedback">意见反馈</button> |
29 | | - <!-- #endif --> |
30 | | - </view> |
31 | | - </view> |
| 2 | + <view> |
| 3 | + <page-head :title="title"></page-head> |
| 4 | + <view class="uni-padding-wrap uni-common-mt"> |
| 5 | + <button type="primary">页面主操作 Normal</button> |
| 6 | + <button type="primary" :loading="loading">页面主操作 Loading</button> |
| 7 | + <button type="primary" disabled="true">页面主操作 Disabled</button> |
| 8 | + |
| 9 | + <button type="default">页面次要操作 Normal</button> |
| 10 | + <button type="default" disabled="true">页面次要操作 Disabled</button> |
| 11 | + |
| 12 | + <button type="warn">警告类操作 Normal</button> |
| 13 | + <button type="warn" disabled="true">警告类操作 Disabled</button> |
| 14 | + |
| 15 | + <view class="button-sp-area"> |
| 16 | + <button type="primary" plain="true">按钮</button> |
| 17 | + <button type="primary" disabled="true" plain="true">不可点击的按钮</button> |
| 18 | + |
| 19 | + <button type="default" plain="true">按钮</button> |
| 20 | + <button type="default" disabled="true" plain="true">按钮</button> |
| 21 | + |
| 22 | + <button class="mini-btn" type="primary" size="mini">按钮</button> |
| 23 | + <button class="mini-btn" type="default" size="mini">按钮</button> |
| 24 | + <button class="mini-btn" type="warn" size="mini">按钮</button> |
| 25 | + </view> |
| 26 | + <!-- #ifdef MP-WEIXIN || MP-QQ --> |
| 27 | + <button open-type="launchApp" app-parameter="uni-app" @error="openTypeError">打开APP</button> |
| 28 | + <button open-type="feedback">意见反馈</button> |
| 29 | + <!-- #endif --> |
| 30 | + </view> |
| 31 | + </view> |
32 | 32 | </template> |
33 | 33 | <script> |
34 | | - export default { |
35 | | - data() { |
36 | | - return { |
37 | | - title: 'button' |
38 | | - } |
39 | | - }, |
40 | | - methods: { |
41 | | - openTypeError(error) { |
42 | | - console.error('open-type error:', error); |
43 | | - } |
44 | | - } |
45 | | - } |
| 34 | + export default { |
| 35 | + data() { |
| 36 | + return { |
| 37 | + title: 'button', |
| 38 | + loading: false |
| 39 | + } |
| 40 | + }, |
| 41 | + onLoad() { |
| 42 | + this._timer = null; |
| 43 | + }, |
| 44 | + onShow() { |
| 45 | + this.clearTimer(); |
| 46 | + this._timer = setTimeout(() => { |
| 47 | + this.loading = true; |
| 48 | + }, 300) |
| 49 | + }, |
| 50 | + onUnload() { |
| 51 | + this.clearTimer(); |
| 52 | + this.loading = false; |
| 53 | + }, |
| 54 | + methods: { |
| 55 | + openTypeError(error) { |
| 56 | + console.error('open-type error:', error); |
| 57 | + }, |
| 58 | + clearTimer() { |
| 59 | + if (this._timer != null) { |
| 60 | + clearTimeout(this._timer); |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + } |
46 | 65 | </script> |
47 | 66 |
|
48 | 67 | <style> |
49 | | - button { |
50 | | - margin-top: 30upx; |
51 | | - margin-bottom: 30upx; |
52 | | - } |
53 | | -
|
54 | | - .button-sp-area { |
55 | | - margin: 0 auto; |
56 | | - width: 60%; |
57 | | - } |
58 | | -
|
59 | | - .mini-btn { |
60 | | - margin-right: 10upx; |
61 | | - } |
| 68 | + button { |
| 69 | + margin-top: 30upx; |
| 70 | + margin-bottom: 30upx; |
| 71 | + } |
| 72 | +
|
| 73 | + .button-sp-area { |
| 74 | + margin: 0 auto; |
| 75 | + width: 60%; |
| 76 | + } |
| 77 | +
|
| 78 | + .mini-btn { |
| 79 | + margin-right: 10upx; |
| 80 | + } |
62 | 81 | </style> |
0 commit comments