React
爱睡的虫虫
本人博客只供自己学习和笔记用途
展开
-
react 常用命令
工具:使用create-react-app脚手架开发npm install -g create-react-appcreate-react-app my-appcd my-app//**启动项目/npm start/*安装依赖*/npm install原创 2018-06-11 16:53:23 · 4135 阅读 · 0 评论 -
Vue、React同一个dom元素如何绑定多个点击事件?
HTML:<button type="button" @click="a();b()">按钮</button>JS:methods:{ a(){ console.log('a'); }, b(){ console.log('b'); }}原创 2017-09-26 10:45:11 · 11009 阅读 · 0 评论 -
2018-7-7 学习笔记,webpack创建reactjs
npm initpackage name: (webpack) mywebpack version: (1.0.0) description: entry point: (index.js) app/index.js test command: git repository: keywords: webpack react author: mqf license: (ISC) ...原创 2018-07-07 23:31:26 · 238 阅读 · 0 评论 -
react.js 框架搭建 脚手架
从零开始搭建reactjs项目 环境要求:nodejs;npm 制定目录下:npm install -g create-react-app /*搭建一个全局的脚手架*/create-react-app my-demo /*创建项目 my-demo是项目名字*/cd my-demo /*进入目录 然后启动*/npm sta...原创 2018-07-07 23:34:52 · 1488 阅读 · 0 评论 -
react 传值方法
子 — 父:子组件:getClick = () =>{ this.props.loginDate("我是子组件的信息~") //调用父组件方法}父组件:loginDate = (res) =>{ console.log(res) this.setState({ loginInf:res //接受子组件的传值 }) }...原创 2018-07-21 14:36:53 · 624 阅读 · 0 评论 -
React项目build之后资源文件路径 问题解决 背景图片
找到node_modules -> react-scripts -> config -> paths.js修改function getServedPath(appPackageJson) { const publicUrl = getPublicUrl(appPackageJson); const servedUrl = envPublicUrl ||...原创 2018-07-27 17:27:13 · 5399 阅读 · 0 评论 -
基于vue、react的倒计时demo
HTML: <div id="example"> <button @click="send"> <span v-if="sendMsgDisabled">{{time+'秒后获取'}}</span> <span v-if="!s原创 2017-10-10 17:38:59 · 1927 阅读 · 0 评论