Vuejs2 为什么,当您在v-select外部单击时,v-model会重置为null?武装分子

Vuejs2 为什么,当您在v-select外部单击时,v-model会重置为null?武装分子,vuejs2,internet-explorer-11,vuetify.js,v-model,v-select,Vuejs2,Internet Explorer 11,Vuetify.js,V Model,V Select,此错误出现在带有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 {      

此错误出现在带有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}
       ]
     }
   }
}
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import axios from 'axio
[..]
在IE11中进行测试时,当您更改v-select的值并在组件外部单击或按tab键时,v-model的值将重置为null。我还有其他v型选择,它们的行为也一样

在main.js文件中,我有如下polyfill:

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}
       ]
     }
   }
}
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import axios from 'axio
[..]
使用v-select组件的IE11中是否有解决此问题的方法?

即使使用此“修复程序”-您在使用Vuetify和IE11时可能会遇到更多问题<已知代码>Vuetify不适用于IE11

注意:我还必须使用
babel polyfill
以及这个“修复”

话虽如此,我已经测试/验证了这个“修复”:


我接受了Matt的答案,创建了一个mixin,每当输入有值时,它就会清除占位符。这要求您修改html以使用占位符值绑定,这是一个难题,除非您有一个自定义控件可以在其中绑定它

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;
    })
  }
}

我的设计是单行的,所以我用“标签”代替“占位符”。
它修复了问题,并显示了我所期望的正确行为。

您可以尝试参考此文档并尝试添加IE缺少的polyfills,这可能有助于解决问题。裁判: