Element: [Bug Report] DatePicker组件加了placeholder=""后异步更新日期数据时,在所有ie浏览器下都不显示更新后的日期值,其它浏览器正常

Created on 28 Nov 2017  ·  23Comments  ·  Source: ElemeFE/element

Element UI version

2.0.5

OS/Browsers version

win10/ie11

Vue version

2.5.9

Reproduction Link

http://jsbin.com/sefetaj/edit?html,js,output

Steps to reproduce

1.DatePicker组件加上placeholder="某某某"
2.异步更新日期数据
3.在所有版本ie浏览器下都不显示更新后的日期值,其它浏览器正常

What is Expected?

正常显示日期

What is actually happening?

ie不显示日期

date-picker help wanted not Element bug windows won't fix

All 23 comments

@Leopoldthecoder 什么时间可以修复~~~

我也遇到相同问题,设置了placeholder以后就无法更新,在ie10,ie edge上。ie9没问题

问题一样,求问啥时候可以修复?

遇到同样的 问题

have the same problem ,how to solve it ?

遇到相同问题了

遇到同样的问题,只有先赋值,然后v-if控制显示才可以

遇到同样的问题了。 跪求解决

遇到的同样的问题。。加了placeholder 就怎么也不能初始化异步加载数据了。。。贼尴尬。。。
先赋值 在v-if是什么套路?

遇到同样的问题,有什么好的解决办法么

这个问题是由于组件先渲染了,后面才取到日期的值,但是后面取到的值,再ie渲染不了,所以不可以显示日期。用v-if判断是否有日期值,有日期值再渲染组件。简单点 <el-date v-if='date' v-model='date'></el-date>

可以手动设置显示:1,添加ref属性ref="datepicker"
2,v-model赋值,此为时间面板日期和时间显示
3,api回调内加上this.$refs.datepicker.$children[0].currentValue="请求的时间",格式与value-format格式相同,可以正常显示

@zhyc18123 试过了没用啊

遇到同样的问题了,这怎么解决?@Leopoldthecoder

https://github.com/vuejs/vue/issues/7138

似乎是给placeholder设置某些字符,在ie上,input标签会触发input事件,通过vue到达el-input,导致el-date-picker下picker.vue里面的userInput被置为了 '' (默认值为null),之后再设置时间的话,获取displayValue就提前结束了。。。

是否可以通过重新设计userInput的默认值去解决 @Leopoldthecoder

可以把时间控件看成渲染后的input输入框,再赋值,渲染后的input输入框在$children下。
时间控件设置ref,使用this.$refs.datepicker.$children[0].currentValue='值'

------------------ 原始邮件 ------------------
发件人: "huangjinqiang"notifications@github.com;
发送时间: 2018年9月24日(星期一) 中午11:58
收件人: "ElemeFE/element"element@noreply.github.com;
抄送: "周俊"1028938635@qq.com; "Comment"comment@noreply.github.com;
主题: Re: [ElemeFE/element] [Bug Report] DatePicker组件加了placeholder=""后异步更新日期数据时,在所有ie浏览器下都不显示更新后的日期值,其它浏览器正常 (#8548)

vuejs/vue#7138

似乎是给placeholder设置某些字符,在ie上,input标签会触发input事件,通过vue到达el-input,导致el-date-picker下picker.vue里面的userInput被置为了 '' (默认值为null),之后再设置时间的话,获取displayValue就提前结束了。。。

是否可以通过重新设计userInput的默认值去解决 @Leopoldthecoder


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

卧槽,现在还没有解决这个问题。

指定format和value-format后可以正常显示了

@liuyang25 设置了还是不行啊。

@rororofff has funded $20.00 to this issue.


@IssuehuntBot 可以把时间控件看成渲染后的input输入框,再赋值,渲染后的input输入框在$children下。
时间控件设置ref,使用this.$refs.datepicker.$children[0].currentValue='值',测试在IE8可行

IE自己问题,我们不会修复。Vue只做部分修复 https://github.com/vuejs/vue/issues/7138

建议兼容IE的时候不用placeholder。另外,请不要操作内部组件currentValue,不保证后续版本兼容。

可以参考 https://github.com/ElemeFE/element/issues/8548#issuecomment-423872488 的方案。必要时候清空 date-picker的userInput属性。

完全可以修复啊,datepicker内置的input输入框 不要直接绑定 用户传进来的placeholder, 新增一个计算属性placeholderNow, 当日期选择器value有值的时候 placeholderNow 置为空,当value无值的时候 placeholderNow 置为 用户设置的placeholder,不就完事了吗

Was this page helpful?
0 / 5 - 0 ratings