当前位置:网站首页>【VEUX开发者工具的使用-getters使用】
【VEUX开发者工具的使用-getters使用】
2022-06-29 12:48:00 【勇敢*牛牛】
基本使用

初始化数据、配置
actions、配置mutations,操作文件store.js//引入Vue核心库 import Vue from 'vue' //引入Vuex import Vuex from 'vuex' //引用Vuex Vue.use(Vuex) const actions = { //响应组件中加的动作 jia(context,value){ // console.log('actions中的jia被调用了',miniStore,value) context.commit('JIA',value) }, } const mutations = { //执行加 JIA(state,value){ // console.log('mutations中的JIA被调用了',state,value) state.sum += value } } //初始化数据 const state = { sum:0 } //创建并暴露store export default new Vuex.Store({ actions, mutations, state, })组件中读取vuex中的数据:
$store.state.sum组件中修改vuex中的数据:
$store.dispatch('action中的方法名',数据)或$store.commit('mutations中的方法名',数据)备注:若没有网络请求或其他业务逻辑,组件中也可以越过actions,即不写
dispatch,直接编写commit


边栏推荐
- Weserver publishing map service
- 灵感收集·创意写作软件评测:Flomo、Obsidian Memo、Napkin、FlowUs
- Sixty years of deep learning
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- Learn from the official motor and BLDC control strategies, and make money as soon as you learn
- 六月集训(第29天) —— 分而治之
- Aurora · Huffman tree generation (segment tree structure non pointer) (imitating adjacency table)
- Equivalence class partition method for test case design method
- 【毕业季】这四年一路走来都很值得——老学长の忠告
- WinDbg common commands
猜你喜欢

vmware虚拟机的作用

云原生(三十一) | Kubernetes篇之Kubernetes平台基本预装资源

3个最佳实践助力企业改善供应链安全

mysql函数和约束

【系统设计】邻近服务

Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions

OpenSSL certificate tool user manual

Online text filter less than specified length tool

pdb符号库文件详解

windows平台下的mysql启动等基本操作
随机推荐
Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions
Notimplementederror: numpy() is only available when Eagle execution is enabled
golang7_TCP编程
Dynamic feedback load balancing strategy based on Cluster
OpenSSL certificate tool user manual
Want to make a wechat game for answering questions? Reading this article is enough
vmware虚拟机的作用
Return value‘s Lifetime
Teach you how to install the latest version of mysql8.0 database on windows, nanny level teaching
Huawei machine learning service speech recognition function enables applications to paint "sound" and color
[document translation] camouflaged object detection
windows平台下的mysql启动等基本操作
grep 精确匹配
成功解决NotImplementedError: numpy() is only available when eager execution is enabled.
Summary of binary tree exercises
Write it down once Net analysis of a property management background service stuck
Solution to inconsistency between RTC time and world time on the server
Cicd introduction [easy to understand]
成功解决ValueError: Only TF native optimizers are supported in Eager mode
Prometheus 2.28.0 new features