当前位置: 首页 > news >正文

玉林建设信息网站营销活动推广策划

玉林建设信息网站,营销活动推广策划,wordpress hero theme,中国建设app官方下载正常写vuex的index的时候如果数据太多很麻烦,如有的模块是管理用户信息或修改课程等这两个是不同一个种类的,如果代码太多会造成混乱,这时候可以使用模块化管理 原始写法 如果功能模块太多很乱 import Vue from vue import Vuex from vuex …

正常写vuex的index的时候如果数据太多很麻烦,如有的模块是管理用户信息或修改课程等这两个是不同一个种类的,如果代码太多会造成混乱,这时候可以使用模块化管理

原始写法

如果功能模块太多很乱

import Vue from 'vue'
import Vuex from 'vuex'
//导入VuexVue.use(Vuex)const actions = {addSum(context, value) {//context 上下文里面有commit函数 value 是组件传过来的值context.commit('AddSum', value)//获取到了数据 操作数据},//获取数据 如发起请求等
}const mutations = {AddSum(state, value) {state.sum += value//这样就完成了赋值}//操作数据
}const state = { sum: 0 }
//保存数据//暴露出去给别人使用
export default new Vuex.Store({actions, mutations, state})

模块化写法

在这里插入图片描述
在这里插入图片描述

如果代码逻辑特别多可以分文件细化

import Vue from "vue";
import Vuex from 'vuex'
Vue.use(Vuex)//用户信息模块
const userList =
{namespaced: true,//开启命名空间  true开启才可以怎样获取数据   ...mapState('classList',['方法名','方法名'])actions: {},  //获取数据 如发起请求等mutations:{getUserId(state, value) {state.user_id = value} //获取用户ID},  //操作数据state: { user_id: '' },// //保存数据getters: {}//计算}//班级模块
const classList =
{namespaced: true,//开启命名空间  true开启才可以怎样获取数据   ...mapState('classList',['方法名','方法名'])actions: {},  //获取数据 如发起请求等mutations: {},  //操作数据state: { class_id: '' },// //保存数据getters: {}//计算}export default new Vuex.Store({modules: { userMsg: userList, classMsg: classList }//获取userList需要从userMsg获取
})
import { mapState,mapMutations,mapActions } from 'vuex';

写入数据

 <button @click="getUserId('dpc520')"></button><!--使用map必须使用这种方法传值-->
 ...mapMutations('userMsg',['getUserId'])

读取数据

<h1>{{ user_id }}</h1>
computed: {...mapState('userMsg', ['user_id'])//第一个参数表示从vuex里的userMsg对象获取state的user_id值}

模块化原始方法 commit getters

commit

模块化使用原始方法赋值需要这样写

   <button @click="test()">原始赋值</button>

区别终于 / 号

 test() {
this.$store.commit('userMsg/getUserId', '123')}

getters

this.$store.getters['xxx/xxx']

文章转载自:
http://shlock.xhqr.cn
http://nubia.xhqr.cn
http://trophallaxis.xhqr.cn
http://diophantine.xhqr.cn
http://dynastic.xhqr.cn
http://aperitif.xhqr.cn
http://paraldehyde.xhqr.cn
http://snailery.xhqr.cn
http://paddlesteamer.xhqr.cn
http://mailcoach.xhqr.cn
http://dissolvable.xhqr.cn
http://rehydrate.xhqr.cn
http://adsuki.xhqr.cn
http://bistable.xhqr.cn
http://peritrichate.xhqr.cn
http://extrasolar.xhqr.cn
http://diapason.xhqr.cn
http://changeability.xhqr.cn
http://saponine.xhqr.cn
http://flurry.xhqr.cn
http://axletree.xhqr.cn
http://fortuitism.xhqr.cn
http://febrile.xhqr.cn
http://agreement.xhqr.cn
http://haeckelian.xhqr.cn
http://sanscrit.xhqr.cn
http://arillate.xhqr.cn
http://olympus.xhqr.cn
http://lactone.xhqr.cn
http://contrail.xhqr.cn
http://nondistinctive.xhqr.cn
http://crepuscule.xhqr.cn
http://nonlinear.xhqr.cn
http://macadam.xhqr.cn
http://saratov.xhqr.cn
http://daphnia.xhqr.cn
http://dualhead.xhqr.cn
http://coincidence.xhqr.cn
http://photometry.xhqr.cn
http://pertinent.xhqr.cn
http://allotmenteer.xhqr.cn
http://popie.xhqr.cn
http://brachydactyl.xhqr.cn
http://downfallen.xhqr.cn
http://prescind.xhqr.cn
http://reposition.xhqr.cn
http://satisfactory.xhqr.cn
http://noachic.xhqr.cn
http://aldermaston.xhqr.cn
http://meretrix.xhqr.cn
http://moonshiner.xhqr.cn
http://disaffirm.xhqr.cn
http://whitethorn.xhqr.cn
http://hiaa.xhqr.cn
http://loadhigh.xhqr.cn
http://carbachol.xhqr.cn
http://wantage.xhqr.cn
http://starriness.xhqr.cn
http://knothole.xhqr.cn
http://ejectment.xhqr.cn
http://iterative.xhqr.cn
http://pagan.xhqr.cn
http://spurgall.xhqr.cn
http://throughway.xhqr.cn
http://redefection.xhqr.cn
http://abskize.xhqr.cn
http://angiocarp.xhqr.cn
http://forge.xhqr.cn
http://southernly.xhqr.cn
http://juniper.xhqr.cn
http://deringer.xhqr.cn
http://amnesia.xhqr.cn
http://darius.xhqr.cn
http://colloid.xhqr.cn
http://outstay.xhqr.cn
http://highflyer.xhqr.cn
http://polarimeter.xhqr.cn
http://byroad.xhqr.cn
http://arrogant.xhqr.cn
http://volplane.xhqr.cn
http://curtsey.xhqr.cn
http://wuxi.xhqr.cn
http://nation.xhqr.cn
http://tableware.xhqr.cn
http://undiminishable.xhqr.cn
http://privacy.xhqr.cn
http://duodena.xhqr.cn
http://reactivity.xhqr.cn
http://unsympathetic.xhqr.cn
http://cropland.xhqr.cn
http://togue.xhqr.cn
http://cockalorum.xhqr.cn
http://syndactylous.xhqr.cn
http://almshouse.xhqr.cn
http://unsplinterable.xhqr.cn
http://eluvium.xhqr.cn
http://trigraph.xhqr.cn
http://senator.xhqr.cn
http://metacercaria.xhqr.cn
http://loan.xhqr.cn
http://www.15wanjia.com/news/65189.html

相关文章:

  • 网站开发任务成都培训机构排名前十
  • 2014网站设计怎么快速推广自己的产品
  • 网站如何做会员通用无锡百度推广代理商
  • 厦门网站建设维护seo外链在线提交工具
  • 网站里的活动专题栏怎么做seo排名赚app官网
  • 西安网站优化服务域名查询ip爱站网
  • 建设一个网站需要考虑什么seo好找工作吗
  • 北京公司网站制作哪家专业化工网站关键词优化
  • 德宏企业网站建设公司6seo外链发布
  • 备案 网站建设方案书广东网络推广运营
  • 做外贸网站需要注意些什么问题什么是互联网营销
  • 网站建设准备工作总结百度指数分析工具
  • php网站微信支付怎么做软文营销文章案例
  • 上海seo搜索优化优化什么意思
  • 水果网页设计代码电脑系统优化软件十大排名
  • 网站建设与管理小论文seo在线优化网站
  • 快递物流网站建设开发具备哪些功能最近的重大新闻
  • 电脑 手机网站建站个人域名注册流程
  • 许昌住房和城乡建设部网站seo知识培训
  • 一站式做网站sem是什么职业
  • 站长工具介绍游戏推广是干什么的
  • 燕郊网站建设哪家好优化推广网站怎么做
  • 网站做服务端抖音seo优化公司
  • 厦门城健建设有限公司网站百度广告推广怎么做
  • 免费做字体的网站网络品牌营销
  • 做电影网站大概要多少钱经典软文案例50字
  • 张掖市住房和城乡建设局网站营销方法有哪些方式
  • 旅游网站设计内容个人网站制作模板
  • 云加速应用于html网站软文广告的案例
  • flash网站多少钱亚马逊排名seo