• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

在严格模式下使用Vuex,当用户输入时,v-model会尝试直接修改属性值,但是这个修改在变异中是不修改的,所以会抛出错误。当您需要在组件中使用vuex中的状态时,有两种解决方案:

1.在input中绑定value(vuex中的state),然后监听input的change或input事件,在事件回调中调用mutate修改state的值。

2.使用带有setter的双向绑定来计算属性。参见以下示例(来自官方文件):

输入v-model=' message ' computed : { message : { get(){ return this。$store.state.obj.message },set (value) { this。$store.commit('updateMessage ',value) } }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now