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-mode总是提示错误 v-model  directives require the attribute value which is valid as LHS.

image.png

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

解决方法

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

v-model="msgFilteredHTML"

export default {
    ...
    computed: { 
        msgFilteredHTML: {
            get() {
                return this.filterHTML(this.msg)
            },
            set(val) {
                this.msg = val
            }
        }
    }
}
原文链接:https://www.f2er.com/vue/538117.html

猜你在找的Vue相关文章