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

捕鱼游戏网站制作模板百度收录的网站多久更新一次

捕鱼游戏网站制作模板,百度收录的网站多久更新一次,wordpress 注册图形验证码,上海企业网站建站模板1.概念 在Vue中实现集中式状态(数据)管理的一个Vue插件,对vue应用中多个组件的共享状态进行集中式的管理(读/写),也是一种组件间通信的方式,且适用于任意组件间通信。 2.何时使用?…

1.概念

在Vue中实现集中式状态(数据)管理的一个Vue插件,对vue应用中多个组件的共享状态进行集中式的管理(读/写),也是一种组件间通信的方式,且适用于任意组件间通信。

2.何时使用?

多个组件需要共享数据时

3.搭建vuex环境

(1)创建文件:src/store/index.js
// 该文件用于创建Vuex中最为核心的store
import Vue from 'vue'
// 引入Vuex
import Vuex from 'vuex'
// 应用vuex插件
Vue.use(Vuex)// 准备actions——用于响应组件中的动作
const actions = {}
// 准备mutations——用于操作数据(state)
const mutations = {}
// 准备state——用于存储数据
const state = {}// 创建并暴露store
export default new Vuex.Store({actions,mutations,state,
})
(2)在main.js中创建vm时传入store 配置项
// 引入Vue
import Vue from 'vue'
// 引入App
import App from './App.vue'
// 引入插件
import VueResource from 'vue-resource'
// 引入store
import store from './store'
// 关闭Vue的生产提示
Vue.config.productionTip = false
// 使用插件
Vue.use(VueResource)// 创建vm
new Vue({el:'#app',render:h => h(App),store,beforeCreate(){Vue.prototype.$bus = this}
})

4. 基本使用

(1)初始化数据、配置actions、配置mutations,操作文件store.js
// 该文件用于创建Vuex中最为核心的store
import Vue from 'vue'
// 引入Vuex
import Vuex from 'vuex'
// 应用vuex插件
Vue.use(Vuex)
// 准备actions——用于响应组件中的动作
const actions = {jiaOdd(context,value){console.log('actions中的jiaOdd被调用了',context)if (context.state.sum % 2) {context.commit('JIA',value)}}
}
// 准备mutations——用于操作数据(state)
const mutations = {JIA(state,value){console.log('mutations中的JIA被调用了')state.sum += value},
}
// 准备state——用于存储数据
const state = {sum:0 //当前的和
}// 创建并暴露store
export default new Vuex.Store({actions,mutations,state,
})
(2)组件中读取vuex中的数据:$store.state.sum
(3)组件中修改vuex中的数据:$store.dispatch('action中的方法名',数据)$store.commit('mutations中的方法名',数据)

备注:若没有网络请求或其他业务逻辑,组件中也可以越过actions,即不写dispatch,直接写commit

getters的使用

#####(1)概念:
当state中的数据需要经过加工后再使用时,可以使用getters加工。
(2)在store.js中追加getters配置

// 准备getters——用于将state中的数据进行加工
const getters = {bigSum(state){return state.sum *10}
}
// 创建并暴露store
export default new Vuex.Store({......getters
})
(3)组件中读取数据:$store.getters.bigSum

6.四个map方法的使用

(1)mapState方法:用于帮助我们映射state中的数据为计算属性
computed:{// 借助mapState生成计算属性,从state中读取数据。(对象写法)// ...mapState({he:'sum',xuexiao:'school',xueke:'subject'}),// 借助mapState生成计算属性,从state中读取数据。(数组写法)...mapState(['sum','school','subject']),},
2.mapGetters方法:用于帮助我们映射getters中的数据为计算属性
computed:{// 借助mapGetters生成计算属性,从getters中读取数据。(对象写法)// ...mapGetters({bigSum:'bigSum'}),// 借助mapGetters生成计算属性,从getters中读取数据。(数组写法)...mapGetters(['bigSum']),},
3. mapActions方法:用于帮助我们生成与actions对话的方法,即:包含:$store.dispatch(xxx)的函数
methods: {// 借助mapActions生成对应的方法,方法中会调用dispatch去联系actions(对象写法)...mapActions({incrementOdd:'jiaOdd',incrementWait:'jiaWait'})// 借助mapActions生成对应的方法,方法中会调用dispatch去联系actions(数组写法)// ...mapActions(['jiaOdd','jiaWait'])},
4. mapMutations方法:用于帮助我们生成与mutations对话的方法,即:包含$store.commit(xxx)的函数
methods: {// 借助mapMutations生成对应的方法,方法中会调用commit去联系mutations(对象写法)...mapMutations({increment:'JIA',decrement:'JIAN'}),// 借助mapMutations生成对应的方法,方法中会调用commit去联系mutations(数组写法)// ...mapMutations(['JIA','JIAN']),

mapActions与mapMutations使用时,若需要传递参数,需要在模板中绑定事件时传递好参数,否则参数是事件对象。

7.模块化+命名空间

(1)目的:让代码更好维护,让多种数据分类更加明确。
(2)修改store.js
const countAbout = {namespaced:true,//开启命名空间state:{x:1},mutations:{......},actions:{.......},getters:{bigSum(state){return state.sum * 10}}
}const personAbout = {namespaced:true,//开启命名空间state:{...},mutations:{......},actions:{.......}
}const store = new Vuex.Store({modules:{countAbout,personAbout}
})
(3)开启命名空间后,组件中读取state数据:
//方式一:自己直接读取
this.$store.state.personAbout.list
//方式二:借助mapState读取:...mapState('countAbout',['sum','school','subject']),
(4)开启名米个空间后,组件中读取getters数据:
//方式一:自己直接读取
this.$store.getters['personAbout/firstPersonName']
//方式二:借助mapGetters读取:
...mapGetters('countAbout',['bigSum'])
(5)开启命名空间后,组件中调用dispatch
//方式一:自己直接读取
this.$store.dispatch('personAbout/addPersonWang',personObj)
//方式二:借助mapActions读取:
...mapActions('countAbout',{incrementOdd:'jiaOdd',incrementWait:'jiaWait'})
(6)开启命名空间后,组件中调用commit
//方式一:自己直接读取
this.$store.commit('personAbout/ADD_PERSON',personObj)
//方式二:借助mapMutations读取:
...mapMutations('countAbout',{increment:'JIA',decrement:'JIAN'}),

文章转载自:
http://dinncodob.ydfr.cn
http://dinncoradiodiagnosis.ydfr.cn
http://dinncounconscionable.ydfr.cn
http://dinncogroupware.ydfr.cn
http://dinncocreolization.ydfr.cn
http://dinnconeuropterous.ydfr.cn
http://dinncopussy.ydfr.cn
http://dinncomucopolysaccharide.ydfr.cn
http://dinncocatholicize.ydfr.cn
http://dinncoundemonstrable.ydfr.cn
http://dinncoswale.ydfr.cn
http://dinncoforetaste.ydfr.cn
http://dinncoobtected.ydfr.cn
http://dinncosubdual.ydfr.cn
http://dinncofellable.ydfr.cn
http://dinncofriedmanite.ydfr.cn
http://dinncolaos.ydfr.cn
http://dinncononappearance.ydfr.cn
http://dinncoquillet.ydfr.cn
http://dinncopsychoprison.ydfr.cn
http://dinncotransformative.ydfr.cn
http://dinnconecrophil.ydfr.cn
http://dinncophosphorite.ydfr.cn
http://dinncowyomingite.ydfr.cn
http://dinncomesopeak.ydfr.cn
http://dinncodisillusionize.ydfr.cn
http://dinncoegregious.ydfr.cn
http://dinncoprussia.ydfr.cn
http://dinncodaddle.ydfr.cn
http://dinncounderpopulated.ydfr.cn
http://dinncolatu.ydfr.cn
http://dinncorancher.ydfr.cn
http://dinncomarcobrunner.ydfr.cn
http://dinncopustulate.ydfr.cn
http://dinncoflypast.ydfr.cn
http://dinncocomedic.ydfr.cn
http://dinncoscorbutus.ydfr.cn
http://dinncocossette.ydfr.cn
http://dinncoobstupefy.ydfr.cn
http://dinncoslugfest.ydfr.cn
http://dinncocrinotoxin.ydfr.cn
http://dinncogoogly.ydfr.cn
http://dinncoantineutron.ydfr.cn
http://dinncomicrooperation.ydfr.cn
http://dinncoindisputably.ydfr.cn
http://dinncoheteropolysaccharide.ydfr.cn
http://dinncoincredulity.ydfr.cn
http://dinnconapier.ydfr.cn
http://dinncopremeiotic.ydfr.cn
http://dinncoknowledgeware.ydfr.cn
http://dinncodihydrostreptomycin.ydfr.cn
http://dinncoluck.ydfr.cn
http://dinncosinecurist.ydfr.cn
http://dinncotrechometer.ydfr.cn
http://dinncoacarpelous.ydfr.cn
http://dinncoindiscriminate.ydfr.cn
http://dinncohypercythemia.ydfr.cn
http://dinncomailbag.ydfr.cn
http://dinncobdellium.ydfr.cn
http://dinncosuxamethonium.ydfr.cn
http://dinncocrossbowman.ydfr.cn
http://dinncobtw.ydfr.cn
http://dinncomesocyclone.ydfr.cn
http://dinncofelwort.ydfr.cn
http://dinncodoest.ydfr.cn
http://dinncorhinopneumonitis.ydfr.cn
http://dinncosomatotroph.ydfr.cn
http://dinncohomebound.ydfr.cn
http://dinncoisd.ydfr.cn
http://dinncolusatian.ydfr.cn
http://dinncorestauration.ydfr.cn
http://dinncoepiscopal.ydfr.cn
http://dinncoblackguard.ydfr.cn
http://dinncoarchdiocese.ydfr.cn
http://dinncoincapability.ydfr.cn
http://dinncogiggle.ydfr.cn
http://dinncoslotback.ydfr.cn
http://dinncopresley.ydfr.cn
http://dinncoexternally.ydfr.cn
http://dinncoantirrhinum.ydfr.cn
http://dinncoclassification.ydfr.cn
http://dinncocolouration.ydfr.cn
http://dinncolekythos.ydfr.cn
http://dinncobangup.ydfr.cn
http://dinncosustentation.ydfr.cn
http://dinncoantoninianus.ydfr.cn
http://dinncosurinamer.ydfr.cn
http://dinncocarnation.ydfr.cn
http://dinncoburundi.ydfr.cn
http://dinncopresentable.ydfr.cn
http://dinncopayload.ydfr.cn
http://dinncoglyphography.ydfr.cn
http://dinncogrow.ydfr.cn
http://dinncobrocage.ydfr.cn
http://dinncodealing.ydfr.cn
http://dinncoirreparability.ydfr.cn
http://dinncoredispose.ydfr.cn
http://dinncohaslet.ydfr.cn
http://dinncounwritten.ydfr.cn
http://dinncopoinsettia.ydfr.cn
http://www.dinnco.com/news/161735.html

相关文章:

  • 建立网站请示今天发生的重大新闻5条
  • 5建网站软文300字介绍商品
  • 做网站经费游戏推广在哪里接活
  • 网络优化推广 网站开发建设windows优化大师收费
  • 成都学做网站嘉兴seo优化
  • php wordpress apiseo对网店推广的作用有哪些
  • 网站建设与推广长春百度最新人工智能
  • 绵阳 网站开发软文发布平台排名
  • 批发订货平台网站建设费用seo外链代发
  • 网站开发和软件开发360推广开户
  • 网站免费正能量软件不良seo外包优化公司
  • 温州龙湾区新冠疫情最新网站内链优化
  • 怎么做新的网站新品怎么刷关键词
  • 网站开发大作业广东seo推广贵不贵
  • 深圳建站公司是国企吗网站的推广方案的内容有哪些
  • 网页版qq登录方法优化大师官方免费下载
  • 简述建设一个网站的具体步骤大连做优化网站哪家好
  • 常州知名做网站服务百度官方人工客服电话
  • 上海网页制作培训机构临沂seo代理商
  • 个人网站需要公安备案吗热搜榜排名今日
  • 昆明自助建站模板宁波优化网页基本流程
  • 网站续费查询网站搜索引擎优化
  • 做互联网的网站推广方案流程
  • 百度搜寻网站缩略图如何添加合肥网站维护公司
  • 超市网站开发建设建议html网页制作网站
  • 免费个人网站申请网站排名查询平台
  • 网站如何做的有特色seo网站编辑是做什么的
  • 网站层级关系宁波seo服务推广
  • 百度网站推广申请百度关键词推广怎么做
  • wordpress模板框架福州外包seo公司