摘要:
方法1: var obj = { a: function() { console.log("a"); return this; }, b: function() { console.log("b"); return this; }, }; obj.a().b();方法二: function Test 阅读全文
摘要:
本文章针对的是如何配置登陆后跳转到首页后如何配置公共部分。 配置入口文件index.js,这里原来是引用到app.js文件的,我这就直接引进路由文件router(也可以直接把router直接引入App.js里面,入口文件里面还是保留之前的) 路由文件的配置: import {HashRouter a 阅读全文
摘要:
react16是有个异常处理生命周期 componentDidCatch 单个组件的处理方法:class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasErro 阅读全文
摘要:
在开发小程序中用到了vant UI框架,这框架确实好用,但是也有些硬伤。 例如: wxml: <van-field value="{{ value }}" placeholder="请输入用户名" bind:change="onChange" /> js: onChange:function(e){ 阅读全文
摘要:
Promise是异步编程的一种解决方案,也是ES6的写法,它其实是一个构造函数,自己身上有all、reject、resolve这几个方法,原型上有then、catch等方法。 不多说,直接上代码: const promise = new promise(function(resolve, rejec 阅读全文
摘要:
在项目中一般都存在封装公共方法,公共方法里面是请求接口返回数据return给调用者。 先定义各一个函数 const getDefaultValue =()=> { let data = { params: [] }; return new Promise((resolve)=>{ $http.pos 阅读全文
摘要:
wxml部分: <view class="content"> <van-cell title="{{index+1}}.{{item.descripts}}" is-link wx:for="{{helpDetail}}" wx:key="index" bindtap="goToDetail" da 阅读全文
摘要:
(react-router-dom自行百度命令行添加包) 在 index.js 中添加 import { HashRouter as Router} from 'react-router-dom' import {Router} from 'react-router-dom' import App 阅读全文
摘要:
方法1:在package.json文件中添加 方法2:本人使用方法一无效,方法二帮我解决了问题。 新增依赖包 npm install --save-dev increase-memory-limit (注意)要是package.json中没有这行命令得手动加上 "fix-memory-limit": 阅读全文
摘要:
导出: 导出的内容是字符串,可直接显示在txt文件的 this.download(‘文件名称’,‘导出的内容’); download=(filename, text)=> { var element = document.createElement('a'); element.setAttribut 阅读全文