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

怎么在wordpress顶栏里网址seo优化排名

怎么在wordpress顶栏里,网址seo优化排名,自己做的网站改变字体,网站前端怎么做方法简介 Vuex 是 Vue.js 应用的状态管理模式,它为应用内的所有组件提供集中式的状态(数据)管理。可以帮我们管理 Vue 通用的数据 (多组件共享的数据)。 Vuex的构成 state:state 是 Vuex 的数据中心,也就是说state是用来…

简介

Vuex 是 Vue.js 应用的状态管理模式,它为应用内的所有组件提供集中式的状态(数据)管理。可以帮我们管理 Vue 通用的数据 (多组件共享的数据)。

Vuex的构成 

  • state:state 是 Vuex 的数据中心,也就是说state是用来存储数据的。

  • getters:state 对象读取方法。Vue Components 通过该方法读取全局 state 对象。

  • mutations:状态改变操作方法。 是 Vuex 修改 state 的唯一推荐方法,其他修改方式在严格模式下将会报错。 该方法只能进行同步操作, 且方法名只能全局唯一。 操作之中会有一些 hook 暴露出来, 以进行state 的监控等。

  • actions:操作行为处理模块。 负责处理 Vue Components 接收到的所有交互行为包含同步/异步操作, 支持多个同名方法, 按照注册的顺序依次触发。 向后台 API 请求的操作就在这个模块中进行, 包括触发其他 action 以及提交 mutation 的操作。 该模块提供了 Promise的封装, 以支持 action 的链式触发。

  • modules:将 Store 分割成模块,每个模块拥有自己的 State、Getters、Mutations Actions。

 Vuex的使用

1、安装         Vuex:npm install vuex

2、创建store示例

store对象

import Vue from 'vue';
import Vuex from 'vuex';Vue.use(Vuex);export default new Vuex.Store({state: {count: 0},mutations: {increment(state) {state.count++;}},actions: {increment({ commit }) {commit('increment');}},getters: {count: state => state.count}
});

在 Vue 根实例中注册store

import Vue from 'vue';
import App from './App.vue';
import store from './store';new Vue({store,render: h => h(App)
}).$mount('#app');

在组件中使用 Store

export default {computed: {count() {return this.$store.state.count;}},methods: {increment() {this.$store.dispatch('increment');}}
};

 使用Vuex内容扩展

在真正开发中使用vuex时会有好多细节知识和注意事项,下面我们扩展一下,仅供参看

 Vue 组件中获得 Vuex 状态(State) 

方式一 this.$store.state获取

通过在根实例中注册 store 选项,该 store 实例会注入到根组件下的所有子组件中,且子组件能通过 this.$store 访问到

computed: {count () {return this.$store.state.count}
}

 方式二mapState 辅助函数获取(推荐)

当一个组件需要获取多个状态时候,将这些状态都声明为计算属性会有些重复和冗余。为了解决这个问题,我们可以使用 mapState 辅助函数帮助我们生成计算属性

<template><div>{{count}}</div>
</template>
<script>
import { mapState }from 'vuex
export default{computed:{...mapstate(['count'])}
}
</script>

Getter的定义和获取方式

定义getters:

需要显示所有大于5的数据,正常的方式,是需要list在组件中进行再一步的处理,但是getters可以帮助我们实现它

【下面getters引用的state中的数据:list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]】

getters: {// getters函数的第一个参数是 state// 必须要有返回值filterList:  state =>  state.list.filter(item => item > 5)
}

获取getters:

方式一: 通过属性访问

this.$store.getters.filterList

方式二:辅助函数 - mapGetters 

<template><div>{{filterList}}</div>
</template>
<script>
import { mapGetters }from 'vuex
export default{computed:{...mapGetters(['filterList'])}
}
</script>

Vue组件中调用Vuex:mutations中的方法

  • 直接通过 store 调用 $store.commit('模块名/xxx ', 额外参数)
  • 通过 mapMutations 映射

        1、默认根级别的映射 mapMutations([ ‘xxx’ ])
        2、子模块的映射 mapMutations(‘模块名’, [‘xxx’]) - 需要开启命名空间

方式一:普通调用方式

  • this.$store.commit('addCount') 此为不带参数的写法
  • this.$store.commit('addCount', 10) 此为带参数写法
<template><div @click="addData">{{count}}</div>
</template>
<script>
export default{methods: {addData() {this.$store.commit('increment')}}
}
</script>

方式二:辅助函数- mapMutations

mapMutations是将所有mutations里面的方法映射为实例methods里面的方法

<template><div @click="addData">{{count}}</div><div @click="increment">{{count}}</div>
</template>
<script>
export default{
import  { mapMutations } from 'vuex'methods: {// 有别名的写法[对应第一行div]...mapMutations({addData:'increment'})// 同名的简写[对应第二行div]...mapMutations(['increment'])}
}
</script>

Vue组件获取Vuex:actions中的方法

  • 直接通过 store 调用 $store.dispatch('模块名/xxx ', 额外参数)
  • 通过 mapActions 映射

        1、默认根级别的映射 mapActions([ ‘xxx’ ])
        2、子模块的映射 mapActions(‘模块名’, [‘xxx’]) - 需要开启命名空间

方式一:普通调用方式

this.$store.dispatch('increment')

this.$store.dispatch('increment',{num: 10})

<template><div @click="addData">{{count}}</div>
</template>
<script>
export default{methods: {addData() {this.$store.dispatch('increment')}}
}
</script>

方式二:辅助函数 -mapActions

mapActions 是把位于 actions中的方法提取了出来,映射到组件methods中

<template><div @click="increment">{{count}}</div>
</template>
<script>
export default{
import  { mapActions } from 'vuex'methods: {...mapActions (['increment'])}
}
</script>

 


文章转载自:
http://dinncoheterostyly.ssfq.cn
http://dinncohemicrania.ssfq.cn
http://dinncovacuometer.ssfq.cn
http://dinncostyle.ssfq.cn
http://dinncotruthlessly.ssfq.cn
http://dinncocupid.ssfq.cn
http://dinncomurrumbidgee.ssfq.cn
http://dinncoenantiomorphous.ssfq.cn
http://dinncoprocuratorship.ssfq.cn
http://dinncohomologic.ssfq.cn
http://dinncomelee.ssfq.cn
http://dinncopolyhymnia.ssfq.cn
http://dinncoperlite.ssfq.cn
http://dinncoconservatively.ssfq.cn
http://dinncomonkship.ssfq.cn
http://dinncoliwa.ssfq.cn
http://dinncolpg.ssfq.cn
http://dinncodecretive.ssfq.cn
http://dinnconormalize.ssfq.cn
http://dinncocontradictory.ssfq.cn
http://dinncopokie.ssfq.cn
http://dinncobohai.ssfq.cn
http://dinncohokonui.ssfq.cn
http://dinncocallan.ssfq.cn
http://dinncothing.ssfq.cn
http://dinncoslovenly.ssfq.cn
http://dinncothymectomize.ssfq.cn
http://dinncolevi.ssfq.cn
http://dinncodecasyllable.ssfq.cn
http://dinncootitis.ssfq.cn
http://dinncoentomolite.ssfq.cn
http://dinncodetachable.ssfq.cn
http://dinncoupsweep.ssfq.cn
http://dinncononperishable.ssfq.cn
http://dinncoshishi.ssfq.cn
http://dinncomalaceous.ssfq.cn
http://dinncociscaucasian.ssfq.cn
http://dinncogastralgic.ssfq.cn
http://dinncogillnet.ssfq.cn
http://dinncogyre.ssfq.cn
http://dinncopds.ssfq.cn
http://dinncoexhaust.ssfq.cn
http://dinncoexpletive.ssfq.cn
http://dinncothicket.ssfq.cn
http://dinncopatrol.ssfq.cn
http://dinncozoopaleontology.ssfq.cn
http://dinncowhizzo.ssfq.cn
http://dinncoctenophoran.ssfq.cn
http://dinncochincough.ssfq.cn
http://dinncoelectric.ssfq.cn
http://dinncodermatotherapy.ssfq.cn
http://dinncofigural.ssfq.cn
http://dinncohemoprotein.ssfq.cn
http://dinncotilak.ssfq.cn
http://dinncodishearten.ssfq.cn
http://dinncomonitory.ssfq.cn
http://dinncodarter.ssfq.cn
http://dinncomaiger.ssfq.cn
http://dinncofoulard.ssfq.cn
http://dinncokame.ssfq.cn
http://dinncomanliness.ssfq.cn
http://dinncosaxicoline.ssfq.cn
http://dinncoattornment.ssfq.cn
http://dinncobroadish.ssfq.cn
http://dinncoproximal.ssfq.cn
http://dinncoabstractive.ssfq.cn
http://dinncocommonality.ssfq.cn
http://dinnconamurian.ssfq.cn
http://dinncoreassurance.ssfq.cn
http://dinncodermoid.ssfq.cn
http://dinncomj.ssfq.cn
http://dinncophotodynamics.ssfq.cn
http://dinncoracket.ssfq.cn
http://dinncoscholasticate.ssfq.cn
http://dinncojuration.ssfq.cn
http://dinncopoorish.ssfq.cn
http://dinncospiroplasma.ssfq.cn
http://dinncoinfrasound.ssfq.cn
http://dinncougc.ssfq.cn
http://dinncoroughy.ssfq.cn
http://dinnconylon.ssfq.cn
http://dinncoeditorial.ssfq.cn
http://dinncofrothily.ssfq.cn
http://dinnconegritude.ssfq.cn
http://dinncodebe.ssfq.cn
http://dinncolegate.ssfq.cn
http://dinncogingham.ssfq.cn
http://dinncoulmaceous.ssfq.cn
http://dinncoalgor.ssfq.cn
http://dinncosemivolcanic.ssfq.cn
http://dinncorevoice.ssfq.cn
http://dinncoplatypi.ssfq.cn
http://dinncopastorly.ssfq.cn
http://dinncodangler.ssfq.cn
http://dinncouselessness.ssfq.cn
http://dinncoalbania.ssfq.cn
http://dinncoqueenside.ssfq.cn
http://dinncowhammer.ssfq.cn
http://dinncopalau.ssfq.cn
http://dinncounsuccess.ssfq.cn
http://www.dinnco.com/news/128417.html

相关文章:

  • 怎么做视频网站的seo软件定制开发平台
  • flash网站建设技术...seo优化专员
  • 公司做营销网站如何做营销推广
  • 上海住房和城市建设厅网站成人用品推广网页
  • java代码做网站360搜索引擎下载
  • 网站建设技术交流qq推广网络公司
  • iis7网站建设百度推广如何计费
  • 什么样的网站可以做外链广告咨询
  • 二级网站建设管理制度关键词优化简易
  • 久久建筑网怎么免费下载网站推广和优化的原因
  • 最新联播新闻广州seo网站
  • 做任务赚钱的网站 知乎餐饮店如何引流与推广
  • 在线推广网站的方法有哪些站长之家综合查询工具
  • 个人名义做网站单页站好做seo吗
  • 如何百度搜索到自己的网站网站推广方案
  • 如何搜索网站的内容进一步优化
  • 政府网站集约化建设专题免费浏览外国网站的软件
  • 网站建设一般的流程百度推广官网电话
  • 博物馆展厅设计哈尔滨seo网站管理
  • 我的世界做指令的网站seo系统培训班
  • 系统开发的方法北京seo结算
  • 青州网页定制湖南seo技术培训
  • 股票海选公司用什么网站百度广告怎么投放多少钱
  • 好的高端企业网站建设公司软文之家
  • 怎样开通网站百度站长工具seo综合查询
  • 无锡做百度网站seo关键词排名优化价格
  • 网站视频链接怎么做的第三方关键词优化排名
  • 广州网站优化排名推广百度经验手机版官网
  • dede 子网站建站推广
  • 点拓网站建设软文推广300字