zoukankan      html  css  js  c++  java
  • 使用mobx 示例

    安装npm i  mobx mobx   然后报错    Support for the experimental syntax 'decorators-legacy' isn't currently enabled
    修改.babelrc文件如下:增加     ["@babel/plugin-proposal-decorators", { "legacy": true }],

    {
      "presets": [
        "@babel/preset-env",
        "@babel/preset-react"
      ],
      "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true }],
        "@babel/plugin-transform-runtime",
        "@babel/plugin-transform-arrow-functions",
        "transform-class-properties",
        "@babel/plugin-syntax-dynamic-import"
      ]
    }
     
    安装完后使用示例:
    store.js

    组件中应用:

     

    然后组件中需要使用的时候调用store.saveData()方法,

    如有需要转换JS格式 用 toJS,引用方法

    import { toJS } from 'mobx';

  • 相关阅读:
    day32-python阶段性复习六
    golang 项目中坑
    golang crawler
    router
    golang in ubuntu
    go channel 案例分析
    go channel learning
    bee go + mgo
    URL escape and unescape
    [转]good sample of Go
  • 原文地址:https://www.cnblogs.com/xiaoyaoweb/p/11418465.html
Copyright © 2011-2022 走看看