|
1 | 1 | <template> |
2 | 2 | <view> |
3 | | - <page-head :title="title"></page-head> |
| 3 | + <page-head title="form"></page-head> |
4 | 4 | <view class="uni-padding-wrap uni-common-mt"> |
5 | 5 | <form @submit="formSubmit" @reset="formReset"> |
6 | 6 | <view class="uni-form-item uni-column"> |
|
13 | 13 | <view class="title">radio</view> |
14 | 14 | <radio-group name="radio"> |
15 | 15 | <label> |
16 | | - <radio value="radio1" />选项一 |
| 16 | + <radio value="radio1" /><text>选项一</text> |
17 | 17 | </label> |
18 | 18 | <label> |
19 | | - <radio value="radio2" />选项二 |
| 19 | + <radio value="radio2" /><text>选项二</text> |
20 | 20 | </label> |
21 | 21 | </radio-group> |
22 | 22 | </view> |
23 | 23 | <view class="uni-form-item uni-column"> |
24 | 24 | <view class="title">checkbox</view> |
25 | 25 | <checkbox-group name="checkbox"> |
26 | 26 | <label> |
27 | | - <checkbox value="checkbox1" />选项一 |
| 27 | + <checkbox value="checkbox1" /><text>选项一</text> |
28 | 28 | </label> |
29 | 29 | <label> |
30 | | - <checkbox value="checkbox2" />选项二 |
| 30 | + <checkbox value="checkbox2" /><text>选项二</text> |
31 | 31 | </label> |
32 | 32 | </checkbox-group> |
33 | 33 | </view> |
|
40 | 40 | <input class="uni-input" name="input" placeholder="这是一个输入框" /> |
41 | 41 | </view> |
42 | 42 | <view class="uni-btn-v"> |
43 | | - <button formType="submit">Submit</button> |
44 | | - <button type="default" formType="reset">Reset</button> |
| 43 | + <button form-type="submit">Submit</button> |
| 44 | + <button type="default" form-type="reset">Reset</button> |
45 | 45 | </view> |
46 | 46 | </form> |
47 | 47 | </view> |
|
51 | 51 | export default { |
52 | 52 | data() { |
53 | 53 | return { |
54 | | - title: 'form', |
55 | | - pickerHidden: true, |
56 | | - chosen: '' |
57 | 54 | } |
58 | 55 | }, |
59 | 56 | methods: { |
60 | | - pickerConfirm: function(e) { |
61 | | - this.pickerHidden = true |
62 | | - this.chosen = e.target.value |
63 | | - }, |
64 | | - pickerCancel: function(e) { |
65 | | - this.pickerHidden = true |
66 | | - }, |
67 | | - pickerShow: function(e) { |
68 | | - this.pickerHidden = false |
69 | | - }, |
70 | 57 | formSubmit: function(e) { |
71 | 58 | console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value)) |
| 59 | + var formdata = e.detail.value |
| 60 | + uni.showModal({ |
| 61 | + content: '表单数据内容:' + JSON.stringify(formdata), |
| 62 | + showCancel: false |
| 63 | + }); |
72 | 64 | }, |
73 | 65 | formReset: function(e) { |
74 | 66 | console.log('清空数据') |
75 | | - this.chosen = '' |
76 | 67 | } |
77 | 68 | } |
78 | 69 | } |
79 | 70 | </script> |
80 | 71 |
|
81 | 72 | <style> |
82 | 73 | .uni-form-item .title { |
83 | | - padding: 20upx 0; |
| 74 | + padding: 20rpx 0; |
84 | 75 | } |
85 | | -</style> |
| 76 | +</style> |
0 commit comments