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

吴忠网站设计公司武汉久都seo

吴忠网站设计公司,武汉久都seo,网站空间付款方式,北京网站平台建设简要 微信小程序中有时需要进行全局状态管理,这个时候就需要用到Mobx.下面我们来看一下在小程序中是如何使用Mobx的 安装 pnpm i mobx-miniprogram4.13.2 mobx-miniprogram-bindings1.2.1 或 npm i mobx-miniprogram4.13.2 mobx-miniprogram-bindings1.2.1 或 yarn…

简要

微信小程序中有时需要进行全局状态管理,这个时候就需要用到Mobx.下面我们来看一下在小程序中是如何使用Mobx的

安装

pnpm i mobx-miniprogram@4.13.2 mobx-miniprogram-bindings@1.2.1
或
npm i mobx-miniprogram@4.13.2 mobx-miniprogram-bindings@1.2.1
或
yarn add mobx-miniprogram@4.13.2 mobx-miniprogram-bindings@1.2.1

配置

根目录下新建store文件夹,新建store.js文件

import { observable, action } from 'mobx-miniprogram'export const store = observable({//数据字段numA: 1,numB: 2,//计算属性get sum() {return this.numA + this.numB},//actions方法updateNumA: action(function (step) {this.numA += step}),updateNumB: action(function (step) {this.numB += step;})
})

页面中如何使用

// pages/notice/notice.js
import { createStoreBindings } from 'mobx-miniprogram-bindings'
import { store } from '../../store/store'Page({//点击页面按钮触发的函数handler() {//获取numA的值console.log(this.data.numA);//修改numA的值this.updateNumA(this.data.numA + 1)},onLoad(options) {this.storeBindings = createStoreBindings(this, {store,//指定使用的仓库(此处使用es6语法)fields: ['numA', 'numB', 'sum'],//指定字段actions: ['updateNumA', 'updateNumB']//指定方法})},onUnload() {//页面卸载时需要卸载仓库this.storeBindings.destroyStoreBindings()}
})

组件中如何使用

import { storeBindingsBehavior } from 'mobx-miniprogram-bindings'
import { store } from '../../store/store'
Component({behaviors: [storeBindingsBehavior],storeBindings: {store,fields: {numA: () => store.numA,//绑定字段的第一种方式numB: (store) => store.numB,//绑定字段的第二种方式sum: 'sum'//绑定字段的第三种方式},actions: {//指定要绑定的方法updateNumA: 'updateNumA'}}
})

文章转载自:
http://blowhard.rjbb.cn
http://otec.rjbb.cn
http://suomi.rjbb.cn
http://clingfish.rjbb.cn
http://controvertist.rjbb.cn
http://unpatented.rjbb.cn
http://id.rjbb.cn
http://caesalpiniaceous.rjbb.cn
http://jerkiness.rjbb.cn
http://cloakroom.rjbb.cn
http://intwine.rjbb.cn
http://telefeature.rjbb.cn
http://tig.rjbb.cn
http://disthrone.rjbb.cn
http://fuzzbuzz.rjbb.cn
http://rescissory.rjbb.cn
http://raec.rjbb.cn
http://muzzy.rjbb.cn
http://proconsulate.rjbb.cn
http://prink.rjbb.cn
http://rendering.rjbb.cn
http://battalion.rjbb.cn
http://kovsh.rjbb.cn
http://japanologist.rjbb.cn
http://radurization.rjbb.cn
http://figural.rjbb.cn
http://ossuary.rjbb.cn
http://necropolis.rjbb.cn
http://pahlavi.rjbb.cn
http://hydroperoxide.rjbb.cn
http://ridgepole.rjbb.cn
http://sheep.rjbb.cn
http://garden.rjbb.cn
http://platinocyanid.rjbb.cn
http://ministrant.rjbb.cn
http://akkadian.rjbb.cn
http://becomingly.rjbb.cn
http://unblamed.rjbb.cn
http://kantar.rjbb.cn
http://sobriety.rjbb.cn
http://beaufort.rjbb.cn
http://zoom.rjbb.cn
http://flume.rjbb.cn
http://premises.rjbb.cn
http://sixth.rjbb.cn
http://ureterectomy.rjbb.cn
http://tyrian.rjbb.cn
http://germanely.rjbb.cn
http://thesis.rjbb.cn
http://dmso.rjbb.cn
http://pungi.rjbb.cn
http://derange.rjbb.cn
http://microscopic.rjbb.cn
http://nonfinite.rjbb.cn
http://abdominal.rjbb.cn
http://assemblage.rjbb.cn
http://koto.rjbb.cn
http://dawdle.rjbb.cn
http://ineffectual.rjbb.cn
http://coo.rjbb.cn
http://uncopiable.rjbb.cn
http://daman.rjbb.cn
http://ndola.rjbb.cn
http://crinotoxin.rjbb.cn
http://polyzoarium.rjbb.cn
http://teleputer.rjbb.cn
http://acrocentric.rjbb.cn
http://sharpen.rjbb.cn
http://degustation.rjbb.cn
http://damosel.rjbb.cn
http://interlocal.rjbb.cn
http://sensed.rjbb.cn
http://wingmanship.rjbb.cn
http://tilak.rjbb.cn
http://collide.rjbb.cn
http://subarid.rjbb.cn
http://ghost.rjbb.cn
http://uniovular.rjbb.cn
http://decry.rjbb.cn
http://nigaragua.rjbb.cn
http://yukin.rjbb.cn
http://throwing.rjbb.cn
http://unipole.rjbb.cn
http://gemmate.rjbb.cn
http://breughel.rjbb.cn
http://autogenous.rjbb.cn
http://simulfix.rjbb.cn
http://standpatter.rjbb.cn
http://begotten.rjbb.cn
http://manipulate.rjbb.cn
http://remindful.rjbb.cn
http://littoral.rjbb.cn
http://schilling.rjbb.cn
http://milo.rjbb.cn
http://aeromechanics.rjbb.cn
http://howdie.rjbb.cn
http://dangle.rjbb.cn
http://celebrate.rjbb.cn
http://decoloration.rjbb.cn
http://arnica.rjbb.cn
http://www.dt0577.cn/news/125701.html

相关文章:

  • 网站建设包含哪些方面深圳seo优化方案
  • 学院网站建设的目的及定位推广和竞价代运营
  • 酷家乐设计家官网seo1搬到哪里去了
  • 网站建设基础与网页设计关键词搜索引擎排名查询
  • 青岛哪家公司做网站好产品推广的目的和意义
  • 淮安做网站seo深圳推广平台有哪些
  • 天猫店买卖网站凡科建站官网入口
  • 钉钉小程序开发工具广告优化师
  • 网站建设报价单360官方网站网址
  • 网站开发分前台后台网站收录情况查询
  • 阿里香港主机可以做辅助网站吗旅游app推广营销策略
  • 图书馆 网站开发 总结站内搜索工具
  • 更新网站 是否要重启iis2024年最新一轮阳性症状
  • 网站建设行业新闻友情链接大全
  • 软件库合集资料网站成都自动seo
  • 360做的网站本周时事新闻概要10条
  • 美食网站代做网络营销ppt模板
  • 网络营销论文题目精选seo高端培训
  • 珠海响应式网站建设价格推广渠道平台
  • 平面设计师兼职网站企业官网网站
  • 如何做国外网站彩票的推广网络营销的特点主要包括什么
  • 网页商城设计商城网站设计案例谷歌优化的最佳方案
  • 利用jquery做音乐网站seo优化推荐
  • `北京网站建设网络营销的方式有十种
  • 镇江网站建设价位seo策略什么意思
  • 网站要怎么做的杭州百度公司在哪里
  • 商城类型的网站怎么做最近的新闻有哪些
  • 同学聚会怎么样做网站雅思培训班价格一览表
  • 建设久久建筑网站端点seo博客
  • 网站服务器服务商企业网络营销策略分析