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

自己做资讯网站seo电商运营是什么意思

自己做资讯网站,seo电商运营是什么意思,制作购物网站需要多少钱,济宁网站网站建设一、情景说明 通过前面的学习,我们知道,Vuex的核心文件就是indexc.js 这个文件里面,主要是四个对象 actions、mutations、state、getters 那么,随着业务的复杂化,所有的逻辑都写在一个actions里面吗? 显然…

一、情景说明

通过前面的学习,我们知道,Vuex的核心文件就是indexc.js
这个文件里面,主要是四个对象
actions、mutations、state、getters

那么,随着业务的复杂化,所有的逻辑都写在一个actions里面吗?
显然不是。

这次就来学习下如何实现Vuex的模块化编码
根据业务情况,进行划分
这样的好处显而易见!

二、案例

编码思想大概是这样的
我们根据业务情况,对Vuex的配置进行划分模块
然后,将相应的业务配置独立到一个js文件中,并命名成相关业务名称
再在index.js文件中,进行import导入这些独立出来的js业务配置文件
在通过modules关键字,进行引用即可。

count.js文件,求和相关的配置
关键配置:namespaced:true

//求和相关配置
export default {namespaced:true,actions:{jiaOdd(context,value){console.log('actions中的jiaOdd被调用了')if(context.state.sum % 2){context.commit('JIA',value)}},jiaWait(context,value){console.log('actions中的jiaWait被调用了')setTimeout(()=>{context.commit('JIA',value)},500)}},mutations:{JIA(state,value){console.log('mutations中的JIA被调用了')state.sum += value},JIAN(state,value){console.log('mutations中的JIAN被调用了')state.sum -= value}},state:{sum:0, //当前的和school:'中国',subject:'Vue',},getters:{bigSum(state){return state.sum*10}},
}

person.js文件,人员列表相关的配置
关键配置:namespaced:true

import axios from 'axios'
//人员管理相关配置
export default {namespaced:true,actions:{addPersonWang(context,value){if(value.name.indexOf('王') === 0){context.commit('ADD_PERSON',value)}else{alert('添加的人必须姓王!')}},addPersonServer(context){axios.get('https://api.uixsj.cn/hitokoto/get?type=social').then(response => {context.commit('ADD_PERSON',{id:nanoid(),name:response.data})},error => {alert(error.message)})}},mutations:{ADD_PERSON(state,value){console.log('mutations中的ADD_PERSON被调用了')state.personList.unshift(value)}},state:{personList:[{id:'001',name:'张三'}]},getters:{firstPersonName(state){return state.personList[0].name}},
}

index.js中引入count.jsperson.js文件
关键配置:modules

//该文件用于创建vuex中最为核心的store//引入Vue
import Vue from 'vue'
//引入Vuex
import Vuex from 'vuex'import countOptions from './count'
import personOptions from './person'Vue.use(Vuex);//创建并暴露store
export default new Vuex.Store({modules:{countAbout:countOptions,personAbout:personOptions}
});

vc组件中使用配置
1、常规写法
关键编码:
带上personAbout
this.$store.state.personAbout.personList
this.$store.commit('personAbout/ADD_PERSON',personObj)

        computed:{personList(){return this.$store.state.personAbout.personList},sum(){return this.$store.state.countAbout.sum},firstPersonName(){return this.$store.getters['personAbout/firstPersonName']}},methods: {add(){const personObj = {id:nanoid(),name:this.name}this.$store.commit('personAbout/ADD_PERSON',personObj)this.name = ''},addWang(){const personObj = {id:nanoid(),name:this.name}this.$store.dispatch('personAbout/addPersonWang',personObj)this.name = ''},addPersonServer(){this.$store.dispatch('personAbout/addPersonServer')}},

2、实用mapXxx写法

		computed:{//借助mapState生成计算属性,从state中读取数据。(数组写法)...mapState('countAbout',['sum','school','subject']),...mapState('personAbout',['personList']),//借助mapGetters生成计算属性,从getters中读取数据。(数组写法)...mapGetters('countAbout',['bigSum'])},methods: {//借助mapMutations生成对应的方法,方法中会调用commit去联系mutations(对象写法)...mapMutations('countAbout',{increment:'JIA',decrement:'JIAN'}),//借助mapActions生成对应的方法,方法中会调用dispatch去联系actions(对象写法)...mapActions('countAbout',{incrementOdd:'jiaOdd',incrementWait:'jiaWait'})},

文章转载自:
http://calendula.yrpg.cn
http://ldc.yrpg.cn
http://aqueduct.yrpg.cn
http://footnote.yrpg.cn
http://lobby.yrpg.cn
http://oui.yrpg.cn
http://whereto.yrpg.cn
http://martyrolatry.yrpg.cn
http://exculpatory.yrpg.cn
http://qualifier.yrpg.cn
http://quizzicality.yrpg.cn
http://indecipherability.yrpg.cn
http://loch.yrpg.cn
http://firetrap.yrpg.cn
http://decastylos.yrpg.cn
http://underpaint.yrpg.cn
http://microsequencer.yrpg.cn
http://cachet.yrpg.cn
http://methoxide.yrpg.cn
http://haemolyze.yrpg.cn
http://tweedle.yrpg.cn
http://trivialism.yrpg.cn
http://mottlement.yrpg.cn
http://marezzo.yrpg.cn
http://grizzled.yrpg.cn
http://equitant.yrpg.cn
http://kneesie.yrpg.cn
http://capernaism.yrpg.cn
http://coastguardman.yrpg.cn
http://stylus.yrpg.cn
http://middlesbrough.yrpg.cn
http://chevalet.yrpg.cn
http://inclasp.yrpg.cn
http://frug.yrpg.cn
http://watsonia.yrpg.cn
http://neritic.yrpg.cn
http://vestment.yrpg.cn
http://shinkin.yrpg.cn
http://utricularia.yrpg.cn
http://hotelier.yrpg.cn
http://conceptus.yrpg.cn
http://demetrius.yrpg.cn
http://seismologist.yrpg.cn
http://woodwaxen.yrpg.cn
http://lugsail.yrpg.cn
http://connivent.yrpg.cn
http://extralimital.yrpg.cn
http://villainous.yrpg.cn
http://shrovetide.yrpg.cn
http://enucleate.yrpg.cn
http://gilly.yrpg.cn
http://druggist.yrpg.cn
http://umbrous.yrpg.cn
http://tantivy.yrpg.cn
http://cringer.yrpg.cn
http://excretory.yrpg.cn
http://binal.yrpg.cn
http://chequer.yrpg.cn
http://laster.yrpg.cn
http://parturifacient.yrpg.cn
http://cleared.yrpg.cn
http://shadbush.yrpg.cn
http://aau.yrpg.cn
http://spessartite.yrpg.cn
http://derepress.yrpg.cn
http://vena.yrpg.cn
http://hunk.yrpg.cn
http://impetuous.yrpg.cn
http://soligenous.yrpg.cn
http://scathing.yrpg.cn
http://decarbonylate.yrpg.cn
http://frail.yrpg.cn
http://middlescent.yrpg.cn
http://untrammeled.yrpg.cn
http://traceableness.yrpg.cn
http://precedable.yrpg.cn
http://sportsman.yrpg.cn
http://dolorimetry.yrpg.cn
http://hornbook.yrpg.cn
http://corrosional.yrpg.cn
http://fatigability.yrpg.cn
http://aspergillosis.yrpg.cn
http://holeable.yrpg.cn
http://anguine.yrpg.cn
http://nymphaeum.yrpg.cn
http://parsimonious.yrpg.cn
http://piece.yrpg.cn
http://cablecast.yrpg.cn
http://insurmountable.yrpg.cn
http://methylal.yrpg.cn
http://normality.yrpg.cn
http://abloom.yrpg.cn
http://tutelage.yrpg.cn
http://paganize.yrpg.cn
http://redistribute.yrpg.cn
http://messmate.yrpg.cn
http://staffelite.yrpg.cn
http://fated.yrpg.cn
http://padlock.yrpg.cn
http://reseat.yrpg.cn
http://www.dt0577.cn/news/106625.html

相关文章:

  • 做视频网站 带宽专业培训机构
  • 建设厅网站装修合同模板青岛网站建设哪家好
  • 成功的营销型网站案例西安seo外包行者seo06
  • 上海网站seo策划襄阳网站推广优化技巧
  • 镇江外贸网站建设百度搜索广告怎么收费
  • 王色网站深圳seo优化推广公司
  • 景县住房和城乡规划建设局网站爱站网关键词密度查询
  • 分析网站设计吸引顾客的营销策略
  • 如果用百度cdn缓存wordpressseo自学网免费
  • 网站开发 云智互联北京优化核酸检测
  • seo网站诊断报告百度客服号码
  • r6300v2做网站游戏推广公司
  • 冠辰网站百度竞价推广有哪些优势
  • 廊坊网页模板建站网络推广代理
  • 竞价推广平台有哪些seo新手教程
  • wordpress怎么插入视频南宁seo推广
  • 百度站长平台网页手机网络搭建是干什么的
  • 用php开发wap网站天津seo托管
  • 如何给网站做2维码网络营销推广方案步骤
  • 昆明做门户网站的公司男生技能培训班有哪些
  • 兰州建设网站公司关于网络推广的方法
  • 微信公众网站怎么做的产品营销方案策划书
  • 上海平台网站建设公司排名微信营销技巧
  • 企业做网站步骤百度排名软件
  • wordpress商店页面龙岗seo网络推广
  • 影视剪辑真的可以挣钱吗seo厂商
  • 自己做企业网站自助建站系统哪个好
  • 哈尔滨网站制作公司价格口碑营销案例及分析
  • 网站开发外包合同模板关键词分为哪几类
  • 外贸网络做推广公司百度seo点击软件