我的页面
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const date = new Date()
|
||||
const years = []
|
||||
const months = []
|
||||
|
||||
for (let i = 1990; i <= date.getFullYear(); i++) {
|
||||
years.push(i)
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
months.push(i)
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
years: years,
|
||||
year: date.getFullYear(),
|
||||
months: months,
|
||||
month: 2,
|
||||
value: [9999, 1, 1],
|
||||
},
|
||||
bindChange: function (e) {
|
||||
const val = e.detail.value
|
||||
this.setData({
|
||||
year: this.data.years[val[0]],
|
||||
month: this.data.months[val[1]],
|
||||
})
|
||||
console.log(this.data)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<view class="i-modal-mask {{ visible ? 'i-modal-mask-show' : '' }}" catchtap='outClick'>
|
||||
<view class="box">
|
||||
<view class="title">{{year}}年{{month}}月</view>
|
||||
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{value}}"
|
||||
bindchange="bindChange">
|
||||
<picker-view-column>
|
||||
<view wx:for="{{years}}" class="item">{{item}}年</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view wx:for="{{months}}" class="item">{{item}}月</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,16 @@
|
||||
.box{
|
||||
height: 300px;
|
||||
}
|
||||
.title{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.item{
|
||||
text-align: center;
|
||||
line-height: 50px
|
||||
}
|
||||
.intro {
|
||||
margin: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
Reference in New Issue
Block a user