











iview 日期组件 BUG 赋值变量选年度 然后当前年会有个蓝色底, 解决方案 :key="ccValue"


<template>
<!-- :key="ccValue" 变量赋值会显示当前年的蓝色底 -->
<DatePicker
type="year"
:editable="false"
class="input"
placement="bottom-start"
split-panels
:value="ccValue"
:key="ccValue"
format="yyyy"
@on-change="handleYearChange"
placeholder="请选择"
:clearable="false"
transfer
style="width: 200px;"
></DatePicker>
</template>
<script>
export default {
components: {},
props: {
value: {
type: String,
default: ''
}
},
data() {
return {}
},
watch: {},
computed: {
ccValue: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
}
}
},
methods: {
handleYearChange(year) {
this.ccValue = year
this.$emit('change', year)
}
},
created() {},
activated() {},
mounted() {},
beforeDestroy() {}
}
</script>
<style lang="less" scoped></style>
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。