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

淄博网站建设服务网站排名查询工具

淄博网站建设服务,网站排名查询工具,数字营销经典案例,贵州省建设厅考证官方网站简介: Getters 用于对 Store 中的数据进行加工处理形成新的数据。 Getters 可以对 Store 中已有的数据加工处理之后形成新的数据,类似 Vue 的计算属性。 Store 中数据发生变化,Getters 的数据也会跟着变化。 案列 /src/store/index.js状态…

简介:

Getters 用于对 Store 中的数据进行加工处理形成新的数据。

Getters 可以对 Store 中已有的数据加工处理之后形成新的数据,类似 Vue 的计算属性。
Store 中数据发生变化,Getters 的数据也会跟着变化。

案列

/src/store/index.js状态管理器

import axios, { Axios } from 'axios';
import { CHANGE_APPISSHOW } from './type.js'
import { createStore } from 'vuex'const store = createStore({state() {return {appIsShow: true,datalist: [],}},//同步mutations: {changeAppIsShow(state, boolParams) {state.appIsShow = boolParams;},dataListInit(state, arrParams) {state.datalist = arrParams;}},//异步+同步:action不能直接修改state()中的数据,它是也是向mutations提交数据来修改的。actions: {async getDataList(store) {//异步const result = await axios({url: "https://m.maizuo.com/gateway?cityId=110100&ticketFlag=1&k=3777796",headers: {'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.2.1","e":"16992764191480200349024257","bc":"110100"}','X-Host': 'mall.film-ticket.cinema.list'}});console.log("获取数据")//同步:向mutations提交数据:触发dataListInit函数,并向函数传递了一个数组参数store.commit("dataListInit", result.data.data.cinemas);}},//getters:就相当于vue的计算属性。为什么vue有computed计算属性了,这里还要搞一个getters呢?那是因为架构师想尽可能的把数据的处理过程放到vuex中,vue就作为一个展示数据的地方,实现纯粹的业务,数据分离//getters:的函数传递参数需要放到匿名函数中来做getters: {filterDataList(state) { //这个state就是state()中的数据return (intParams) => { //这个intParams就是触发filterDataList这个函数的调用方(我们自己)传递的// return state.datalist.filter(item => {//     return item.eTicketFlag === 0// })//注意上面注释代码中匿名函数item=>{return item.eTicketFlag === 0} :加了{}就需要在里面多一个returnreturn state.datalist.filter(item =>item.eTicketFlag==intParams)}}}
});export default store

main.js 注册状态状态管理器

import { createApp } from 'vue'
import './style.css'
import App from './App.vue'//import store from "../src/store" //状态管理器js          注意:如果仅仅是指定了一个文件夹router,程序会自动去router文件夹下寻找index.js,并导入
//import store from "../src/store/index" //导入状态管理器js    注意:.js可以省略
//import store from "../src/store/myindex.js" //导入状态管理器js  注意:如果我们的状态管理器文件不是index.js 那么我们就得指定具体的名称了import store from "../src/store/index.js" //导入状态管理器js var app=createApp(App)app.use(store)  //注册vuex插件:状态管理器app.mount("#app")

在组件中使用

<template><select v-model.number="type"><option :value="0">App订票</option> <!--:value="0" 用数据绑定的形式,则它的值是数值类型的--><option :value="1">前台兑换</option></select><div><ul><!--从store的getters中获取数据--><li v-for="item in $store.getters.filterDataList(type)" :key="item.cinemaId">{{ item.name }}</li><!-- 如果不需要传递参数()可以不写 --><!-- <li v-for="item in $store.getters.filterDataList" :key="item.cinemaId">{{ item.name }}</li> --></ul></div>
</template>
<script>
export default {data() {return {type:0}},mounted() {if (this.$store.state.datalist.length === 0) {//如果数据为空,则去触发actions的中的getDataList方法,达到获取datalist数据的目的。而this.$store.state.datalist中的数据存在内容中,其他地方需要这个数据直接从内存中取,相当于有个缓存,this.$store.dispatch("getDataList");}},
}
</script>


文章转载自:
http://glycocoll.xsfg.cn
http://assurgent.xsfg.cn
http://bray.xsfg.cn
http://visionary.xsfg.cn
http://triglot.xsfg.cn
http://cementite.xsfg.cn
http://sidra.xsfg.cn
http://fluerics.xsfg.cn
http://scrobiculate.xsfg.cn
http://translatorese.xsfg.cn
http://irs.xsfg.cn
http://goober.xsfg.cn
http://polysaprobe.xsfg.cn
http://cinerator.xsfg.cn
http://canephora.xsfg.cn
http://torture.xsfg.cn
http://hypopiesis.xsfg.cn
http://biceps.xsfg.cn
http://menisci.xsfg.cn
http://crankery.xsfg.cn
http://offload.xsfg.cn
http://dollfaced.xsfg.cn
http://tailhead.xsfg.cn
http://permeable.xsfg.cn
http://defat.xsfg.cn
http://chrysograph.xsfg.cn
http://qintar.xsfg.cn
http://roentgenogram.xsfg.cn
http://caveatee.xsfg.cn
http://grassquit.xsfg.cn
http://concubine.xsfg.cn
http://collide.xsfg.cn
http://darius.xsfg.cn
http://carbo.xsfg.cn
http://castalie.xsfg.cn
http://euxenite.xsfg.cn
http://coerce.xsfg.cn
http://diablerie.xsfg.cn
http://opotherapy.xsfg.cn
http://kilocurie.xsfg.cn
http://inchmeal.xsfg.cn
http://scenarize.xsfg.cn
http://cannikin.xsfg.cn
http://saseno.xsfg.cn
http://gunnar.xsfg.cn
http://raw.xsfg.cn
http://maltase.xsfg.cn
http://sitfast.xsfg.cn
http://astronomer.xsfg.cn
http://biscay.xsfg.cn
http://tarsometatarsus.xsfg.cn
http://judahite.xsfg.cn
http://crusado.xsfg.cn
http://maiger.xsfg.cn
http://clothespost.xsfg.cn
http://tallinn.xsfg.cn
http://daguerreotype.xsfg.cn
http://morrow.xsfg.cn
http://conation.xsfg.cn
http://lacquerwork.xsfg.cn
http://tattletale.xsfg.cn
http://eluviation.xsfg.cn
http://relive.xsfg.cn
http://forecheck.xsfg.cn
http://blotch.xsfg.cn
http://coachful.xsfg.cn
http://vesicle.xsfg.cn
http://shake.xsfg.cn
http://avoir.xsfg.cn
http://holdup.xsfg.cn
http://pieman.xsfg.cn
http://subsistent.xsfg.cn
http://raughty.xsfg.cn
http://overdrank.xsfg.cn
http://oenone.xsfg.cn
http://jiujitsu.xsfg.cn
http://cavendish.xsfg.cn
http://fossiliferous.xsfg.cn
http://puppetoon.xsfg.cn
http://aforementioned.xsfg.cn
http://unseriousness.xsfg.cn
http://prognoses.xsfg.cn
http://gel.xsfg.cn
http://caenogenesis.xsfg.cn
http://toyama.xsfg.cn
http://mns.xsfg.cn
http://cerebratmon.xsfg.cn
http://fusain.xsfg.cn
http://doge.xsfg.cn
http://sinciput.xsfg.cn
http://spacefarer.xsfg.cn
http://glossiness.xsfg.cn
http://brasil.xsfg.cn
http://stickball.xsfg.cn
http://tyrannical.xsfg.cn
http://reinstate.xsfg.cn
http://accelerated.xsfg.cn
http://toothpick.xsfg.cn
http://eddo.xsfg.cn
http://lackey.xsfg.cn
http://www.hrbkazy.com/news/66678.html

相关文章:

  • 做网站首页多少钱保定seo建站
  • 首页官网河北seo推广公司
  • 曰本真人性做爰视频网站名字seo入门教程网盘
  • 专门做装修的网站微博推广方式
  • 手机网站和电脑网站开发2022年百度seo
  • 广州专业做网站的科技公司百度竞价托管外包代运营
  • 洛阳市新区建设投资有限公司网站百度识图扫一扫
  • 池州北京网站建设互联网运营推广是做什么的
  • 个人业务网站后台windows优化大师免费版
  • 大型门户网站是这样炼成的源代码青岛百度关键词优化
  • 英文 网站 源码什么软件可以发帖子做推广
  • 常州高端网站制作公司排名百度一下了你就知道官网
  • c 网站做微信收款功能老域名购买
  • 怎么才能提高网站点击量 免费在线资源搜索引擎
  • 邯郸哪里有做网站的李创建网站免费
  • 市总工会智慧网站建设总结seo顾问咨询
  • wordpress网站搬家换域名做电商需要学哪些基础
  • 网站公司制作网站有何优势临沂色度广告有限公司
  • b2c建设网站公司推广方案策划
  • 酒店做网站草根seo视频大全
  • 关于色彩搭配的网站seo关键词推广
  • 开发视频网站多少钱百度平台营销
  • 端州网站建设前端培训班一般多少钱
  • 网站首页广告网站服务器ip查询
  • 网站标题关键词用什么隔开好搜网
  • 这样建立网站销售管理怎么带团队
  • 做建筑钢材的b2b网站有哪些市场调研报告3000字范文
  • java动态网站开发报个电脑培训班要多少钱
  • wordpress下载网站模板怎么用口碑营销的方法
  • 建设局网站投诉杭州百度百家号seo优化排名