[转]v-mode 提示错误 v-model directives require the attribute value which is valid as LHS.

v-mode总是提示错误 v-model  directives require the attribute value which is valid as LHS. 为什么调用过滤总是提示这个错呢?解决方法v-model 的值只能是一个变量,是无法应用 filter 的。

v-mode总是提示错误 v-model  directives require the attribute value which is valID as LHS.

为什么调用过滤总是提示这个错呢?

解决方法

v-model 的值只能是一个变量,是无法应用 filter 的。如果需要应用 filter:

v-model="msgFilteredHTML"
 
export default {
    ...
    computed: { 
        msgFilteredHTML: {
            get() {
                return this.filterHTML(this.msg)
            },
            set(val) {
                this.msg = val
            }
        }
    }
}

链接1:v-mode 提示错误 v-model directives require the attribute value which is valid as LHS.

链接2:‘v-model‘ directives require the attribute value which is valid as LHS

链接3:vue3.0 v-model value must be a valid JavaScript member expression.

posted @ 2022-07-08 23:27  rainbow70626  阅读(5417)  评论(0编辑  收藏  举报