diff --git a/src/components/datetime/index.vue b/src/components/datetime/index.vue
index f68853e69..8ae9b0382 100755
--- a/src/components/datetime/index.vue
+++ b/src/components/datetime/index.vue
@@ -120,9 +120,9 @@ export default {
},
mounted () {
const uuid = this.uuid
+ this.$el.setAttribute('id', `vux-datetime-${uuid}`)
if (!this.readonly) {
this.$nextTick(() => {
- this.$el.setAttribute('id', `vux-datetime-${uuid}`)
this.render()
})
}
@@ -212,6 +212,13 @@ export default {
}
},
watch: {
+ readonly (val) {
+ if (val) {
+ this.picker && this.picker.destroy()
+ } else {
+ this.render()
+ }
+ },
show (val) {
if (val) {
this.picker && this.picker.show(this.currentValue)
diff --git a/src/components/datetime/metas.yml b/src/components/datetime/metas.yml
index f3cad364b..0bca9fe6e 100644
--- a/src/components/datetime/metas.yml
+++ b/src/components/datetime/metas.yml
@@ -141,8 +141,10 @@ events:
changes:
next:
en:
+ - '[fix] Re-render when readonly is changed #1593'
- '[feature] Support prop:default-selected-value #1576'
zh-CN:
+ - '[fix] readonly 值变化时重新渲染 #1593'
- '[feature] 支持通过 prop:default-selected-value 设置默认选中日期 #1576'
v2.4.0:
en:
diff --git a/src/demos/Datetime.vue b/src/demos/Datetime.vue
index 5cd52b045..b9d890ce2 100755
--- a/src/demos/Datetime.vue
+++ b/src/demos/Datetime.vue
@@ -18,8 +18,11 @@