此错误在带有Vuetify 1.5.14和Vue 2.x的IE11中出现。 我正在使用v-select组件,如下所示:
form#login-form
v-select#inputTypeDocument(:items = 'type_documents' required v-model='form.typeDocument' placeholder='Type of document')
export default {
data () {
return {
form: {
typeDocument: 2,
numberDocument: '',
password: ''
},
type_documents: [
{text: 'Type 1', value: 1},
{text: 'Type 2', value: 2}
]
}
}
}
然后在IE11中进行测试,当您更改v-select的值并在组件外部单击或按Tab键时,v-model的值将重置为null。我还有其他v选择的行为也一样。
在main.js文件中,我具有如下所示的polyfill:
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import axios from 'axio
[..]
使用v-select组件的IE11中是否有针对此问题的解决方案?
答案 0 :(得分:0)
即使使用此“修复程序”,您在使用Vuetify
和IE11时也会遇到更多麻烦。 Vuetify
不能与IE11一起使用。.
注意:我还必须同时使用babel-polyfill
和此“修复程序”。
话虽如此,我已经测试/验证了此“修复程序”:
<v-select id="input"
:items="type_documents"
required
v-model="form.typeDocument"
:placeholder="form.typeDocument ? undefined : 'Type of document'">
</v-select>
具体来说,此行:
:placeholder="form.typeDocument ? undefined : 'Type of document'">
答案 1 :(得分:0)
我接受了Matt的回答,并创建了一个mixin,只要输入有值,它就会清除占位符。这要求您修改html以使其与placeholderValue绑定,这很麻烦,除非您有一个自定义控件可以在此处绑定它。
export const formFieldMixin = {
inheritAttrs: false,
props: {
placeholder: {
type: String,
default: ''
},
},
data() {
return {
newPlaceholder: undefined
}
},
computed: {
placeholderValue() {
return this.newPlaceholder;
}
},
created() {
this.newPlaceholder = this.placeholder;
this.$on('input', function(e) {
if(typeof(e) !== 'undefined' && e != null && e != ''){
this.newPlaceholder = undefined;
}
else
this.newPlaceholder = this.placeholder;
})
}
}
答案 2 :(得分:0)
我的设计是单行的,所以我用“标签”代替“占位符”。 它解决了问题并显示了我期望的正确行为。