我们有一个名为FilterPanel
的Vutify 3组件;简化版本如下:
<template>
<div>
<v-container>
<v-row>
<v-col cols="3">
<v-select v-model="field" :items="fields" :menu-props="{ auto: true }">
<v-field />
</v-select>
</v-col>
<v-col>
<v-text-field v-model="text" :type="(formats && formats[field]) || 'text'" @keyup.enter="add" />
</v-col>
<v-col cols="2">
<v-btn @click="add()">
Add Filter
<v-icon end theme="dark"> mdi-filter-plus </v-icon>
</v-btn>
</v-col>
</v-row>
</v-container>
<v-chip>
... removed for brevity
</v-chip>
</div>
</template>
Vutify 2版本与此类似:
<template>
<div>
<v-text-field v-model="text" :type="(formats && formats[field]) || 'text'" @keyup.enter="add">
<v-select slot="prepend-inner" v-model="field" :items="fields" menu-props="auto" />
<v-btn slot="append" @click="add()" >
Add Filter
<v-icon right dark>mdi-filter-plus</v-icon>
</v-btn>
</v-text-field>
<v-chip>
... removed for brevity
</v-chip>
</div>
</template>
在后面的文件中(在<scripts>
中),在导出对象的各个methods
中有以下几行:
this.$emit('input', { ...this.value, ...qFields })
个
this.$emit('input', { ...this.value, [this.field]: this.text })
个
this.$emit('input', omit(this.value, key))
个
在Vutify 2版本中,this.value
似乎基本上相当于{ [this.field]: this.text }
(除了w/getters和setters).我不确定这是因为重新组织的代码还是因为Vutify的变化,但现在this.value
似乎还没有定义.
这些排放物到底要达到什么目的?我在我们的代码库中没有看到任何@input
,我查看了Vutify树中的各种组件,也没有明确提到input
事件.
归根结底,我想弄清楚的是我是否应该:
- 只需删除emits 物即可
- 做一些时髦的事情来重建
this.value
(例如this.$emit('input', { ...{ [this.field]: this.text }, ...qFields })
) - 根据Vutify 3中没有的一些更改来更改这些内容
移民指南?我确实注意到了这一点:
@input event has been replaced by @update:model-value on components that support v-model usage.
,但我不确定如果这是相关的,具体需要做什么-更改第一个emit参数,但然后第二个参数呢?
谢谢!