import termPicker from '@/components/term-picker/term-picker.vue'
export default {
components: {
termPicker
}
}
<term-picker
:visable.sync="pickerVisable"
:defaultDate="defaultDate"
:minYear="1990"
:timeLimit="false"
:deferYear="0"
themeColor="#10BE9D"
startText="开始时间"
endText="结束时间"
@confirm="confirm">
</term-picker>
<template>
<view class="content">
<term-picker
:visable.sync="pickerVisable"
:defaultDate="defaultDate"
@confirm="confirm">
</term-picker>
</view>
</template>
<script>
import sofarPicker from '@/components/term-picker/term-picker.vue'
export default {
components: {
sofarPicker
},
data() {
return {
pickerVisable: false,
defaultDate: ['2020-01-01', '2021-01-01']
}
},
methods: {
// 打开日期选择框
openPicker() {
this.pickerVisable = true
},
// 点击确定按钮,返回当前选择的值
confirm(date) {
console.log(date) // ['2021-06-01', '2021-07-01']
}
}
}
</script>
<style>
.content{
width: 100%;
height: 100%;
}
</style>