0
点赞
收藏
分享

微信扫一扫

封装elementui el-date-picker年份组件

鱼满舱 2022-03-30 阅读 63
Vue.component('mydatepicker', {
    props: {
        datatime: {
            type: String,
            default: '2021'
        },
        timetype:{
            type: String,
            default: 'month'
        },
        valueformat: {
            type: String,
            default: 'yyyy-M'
        },
        placeholder: {
            type: String,
            default: '请选择'
        }
    },
    template: `<el-date-picker @change="changepicker" :value-format="valueformat" class="datepicker" v-model="time"
                                    :type="timetype"
                                    :placeholder="placeholder">
        </el-date-picker>`,
    data() {
        return {
            time:this.datatime
        }
    },
    mounted() {

    },
    methods: {
        changepicker(val) {
            console.log("时间组件changepicker", val)
            this.$emit('changepicker', val)
        }
    }
})
举报

相关推荐

0 条评论