vue $set

2019-02-24  本文已影响0人  LH8966

html

<input
          @click="showPickerFun()"
          class="inputText"
          type="text"
          v-model="customer.orderTime"
          readonly
        >
data() {
    return {
      customer: {}
    };
  },

methods

methods: {
onSelect: (selectedTime, selectedText, formatedTime) => {
          this.$set(this.customer, "orderTime", `${formatedTime}`);
        }
}

正确书写规则;

1.数组===> this.$set( Array, index , value)

2.对象===>this.$set(Object,''key'',value)

上一篇下一篇

猜你喜欢

热点阅读