Skip to content

Commit

Permalink
添加picker
Browse files Browse the repository at this point in the history
  • Loading branch information
bearyan committed Dec 6, 2016
1 parent 2c3ebdb commit afe58de
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"example/msg/msg",
"example/msg/msg_success",
"example/msg/msg_fail",
"example/picker/picker",
"example/toast/toast",

"example/navbar/navbar",
Expand Down
2 changes: 1 addition & 1 deletion dist/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Page({
id: 'feedback',
name: '操作反馈',
open: false,
pages: ['actionsheet', 'dialog', 'msg', 'toast']
pages: ['actionsheet', 'dialog', 'msg', 'picker', 'toast']
},
{
id: 'nav',
Expand Down
24 changes: 24 additions & 0 deletions dist/example/picker/picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Page({
data: {
array: ['美国', '中国', '巴西', '日本'],
index: 0,
date: '2016-09-01',
time: '12:01'
},
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
index: e.detail.value
})
},
bindDateChange: function(e) {
this.setData({
date: e.detail.value
})
},
bindTimeChange: function(e) {
this.setData({
time: e.detail.value
})
}
});
19 changes: 19 additions & 0 deletions dist/example/picker/picker.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<view class="page">
<view class="page__hd">
<view class="page__title">Picker</view>
<view class="page__desc">选择器,这里使用小程序原生的picker。</view>
</view>
<view class="page__bd">
<view class="weui-btn-area">
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<button type="default">单列选择器</button>
</picker>
<picker class="weui-btn" mode="time" value="{{time}}" start="09:01" end="21:01" bindchange="bindTimeChange">
<button type="default">时间选择器</button>
</picker>
<picker class="weui-btn" mode="date" value="{{date}}" start="2015-09-01" end="2017-09-01" bindchange="bindDateChange">
<button type="default">日期选择器</button>
</picker>
</view>
</view>
</view>
3 changes: 3 additions & 0 deletions dist/example/picker/picker.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page{
background-color: #FFFFFF;
}
1 change: 1 addition & 0 deletions src/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"example/msg/msg",
"example/msg/msg_success",
"example/msg/msg_fail",
"example/picker/picker",
"example/toast/toast",

"example/navbar/navbar",
Expand Down
2 changes: 1 addition & 1 deletion src/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Page({
id: 'feedback',
name: '操作反馈',
open: false,
pages: ['actionsheet', 'dialog', 'msg', 'toast']
pages: ['actionsheet', 'dialog', 'msg', 'picker', 'toast']
},
{
id: 'nav',
Expand Down
24 changes: 24 additions & 0 deletions src/example/picker/picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Page({
data: {
array: ['美国', '中国', '巴西', '日本'],
index: 0,
date: '2016-09-01',
time: '12:01'
},
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
index: e.detail.value
})
},
bindDateChange: function(e) {
this.setData({
date: e.detail.value
})
},
bindTimeChange: function(e) {
this.setData({
time: e.detail.value
})
}
});
19 changes: 19 additions & 0 deletions src/example/picker/picker.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<view class="page">
<view class="page__hd">
<view class="page__title">Picker</view>
<view class="page__desc">选择器,这里使用小程序原生的picker。</view>
</view>
<view class="page__bd">
<view class="weui-btn-area">
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<button type="default">单列选择器</button>
</picker>
<picker class="weui-btn" mode="time" value="{{time}}" start="09:01" end="21:01" bindchange="bindTimeChange">
<button type="default">时间选择器</button>
</picker>
<picker class="weui-btn" mode="date" value="{{date}}" start="2015-09-01" end="2017-09-01" bindchange="bindDateChange">
<button type="default">日期选择器</button>
</picker>
</view>
</view>
</view>
3 changes: 3 additions & 0 deletions src/example/picker/picker.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page{
background-color: #FFFFFF;
}

0 comments on commit afe58de

Please sign in to comment.