为什么vuex使用const来声明变量存储 [英] Why vuex use const to declare the variable store

查看:490
本文介绍了为什么vuex使用const来声明变量存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有点让我困惑。为什么Vuex使用const来声明变量存储。商店中的这些数据可以更改。



我尝试过:



有点让我困惑。为什么Vuex使用const来声明变量存储。存储中的这些数据可以更改。

解决方案

const 变量表示您不需要该变量通过在创建之后为其赋予新值来进行更改。



这与对象的活动无关,可以是商店你可以改变它的内容。



所以你不能改变商店,但你可以改变它的内容。


it kind of confuse me. why Vuex use const to declare the variable store. this data in store can be changed.

What I have tried:

it kind of confuse me. why Vuex use const to declare the variable store. this data in store can be changed.

解决方案

A const variable indicates that you don't want that variable to change by assigning it a new value after it has been created.

This has nothing to do with the activity of that "object" be it a "store" which you can change it's contents.

So you can't change the store, but you can change it's contents.


这篇关于为什么vuex使用const来声明变量存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆