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