我的页面,首页来款项目
This commit is contained in:
@@ -10,7 +10,31 @@ for (let i = 1; i <= 12; i++) {
|
||||
months.push(i)
|
||||
}
|
||||
|
||||
Page({
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
// 是否弹出显示
|
||||
visible: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
//点击外部的遮罩层是否允许关闭
|
||||
outClickCanClose: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
// 模式,年或者月,默认只有年
|
||||
mode: {
|
||||
type: String,
|
||||
value: 'year'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
years: years,
|
||||
year: date.getFullYear(),
|
||||
@@ -18,12 +42,39 @@ Page({
|
||||
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)
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
closePopup() {
|
||||
this.triggerEvent("close", {
|
||||
visible: this.data.visible
|
||||
})
|
||||
},
|
||||
outClick(){
|
||||
if (this.data.outClickCanClose){
|
||||
this.triggerEvent("close", {
|
||||
visible: this.data.visible
|
||||
})
|
||||
}
|
||||
},
|
||||
// 日期改变
|
||||
bindChange: function (e) {
|
||||
const val = e.detail.value
|
||||
this.setData({
|
||||
year: this.data.years[val[0]],
|
||||
month: this.data.months[val[1]],
|
||||
})
|
||||
},
|
||||
ok(e){
|
||||
let value = ''
|
||||
if(this.properties.mode === 'month'){
|
||||
value = this.data.year + '-' + this.data.month
|
||||
}else {
|
||||
value = this.data.year
|
||||
}
|
||||
this.triggerEvent("ok", value)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user