摘要: find ./src "(" -name "*.html" -or -name "*.vue" -or -name "*.js" -or -name "*.ts" -or -name "*.css" -or -name "*.styl" -or -name "*.less" -or -name "* 阅读全文
posted @ 2020-08-05 10:55 stumpx 阅读(1476) 评论(0) 推荐(0) 编辑
摘要: autorun响应式函数,常用与打印日志、持久化或者更新UI的代码 var numbers = observable([1,2,3]);var disposer = autorun(() => console.log(sum.get())); // 输出 '6' numbers.push(4); / 阅读全文
posted @ 2020-08-01 17:52 stumpx 阅读(1173) 评论(0) 推荐(0) 编辑
摘要: 测试中 使用mobx的响应函数autorun监听状态变化进行赋值和运行函数,页面onLoad时执行所有autorun,页面onUnload时销毁所有autorun observer.ts import {autorun, IReactionDisposer, IReactionPublic, rea 阅读全文
posted @ 2020-07-31 12:09 stumpx 阅读(720) 评论(0) 推荐(0) 编辑
摘要: Typescript Class import _ from "lodash"; /**类 ${NAME}*/ export default class ${NAME} { /**v-for :key*/ forKey?: string = _.uniqueId() constructor(obj? 阅读全文
posted @ 2020-07-22 10:18 stumpx 阅读(782) 评论(0) 推荐(0) 编辑
摘要: 使用 // @/utils/Config.tsimport {EPlatform} from './EPlatform'; import {isH5, Platform} from '@/utils/Platform' /**配置信息*/ export default class Config { 阅读全文
posted @ 2020-07-12 17:46 stumpx 阅读(27222) 评论(0) 推荐(0) 编辑
摘要: 直接在小程序中使用lodash会报错,原因可参考 https://blog.xinshangshangxin.com/2016/11/30/mina-lodash/ 在 import {_} from 'lodash' 之前先 import 'fix' fix.js /*fix.js*//*修复lo 阅读全文
posted @ 2020-06-30 10:21 stumpx 阅读(2679) 评论(0) 推荐(0) 编辑
摘要: 小程序相册授权和保存图片到相册 //保存图片 saveImgToAlbum: function () { const _this = this; console.log('has.this.data.tempFilePath', _this.data.tempFilePath); if (!!_th 阅读全文
posted @ 2020-06-23 18:36 stumpx 阅读(635) 评论(0) 推荐(0) 编辑
摘要: 在小程序中使用状态管理mobx 使用mobx后,进入二级页面修改数据返回一级页面显示的数据跟着变 先看效果 控制台打印的数据 以下是代码 store.js // js/store.js // 手动安装时引入的路径 import {configure, extendObservable} from " 阅读全文
posted @ 2020-06-18 19:40 stumpx 阅读(939) 评论(0) 推荐(0) 编辑
摘要: 微信浏览器中免授权获取用户ID, 在微信开发中,用户ID是通过用户授权后可以获取到用户的openid或unionid, 在没有授权时,也可以生成一个用户ID, 接下来介绍使用Fingerprintjs2生成用户ID,此方法只适合同一设备同一浏览器使用, 注:wifi和4g环境获取到的ID不一致,去掉 阅读全文
posted @ 2019-06-26 18:26 stumpx 阅读(2704) 评论(0) 推荐(0) 编辑
摘要: 使用collect.js处理数组和对象 https://github.com/ecrmnn/collect.js/# 引入collect.js https://github.com/ecrmnn/collect.js/#installation 或 深度去重 https://github.com/e 阅读全文
posted @ 2018-08-22 09:39 stumpx 阅读(918) 评论(0) 推荐(0) 编辑