11 2020 档案

摘要:这个和我上一篇文章是差不多的,只不过这里的组件都不是无状态组件 Test.js import React, { Component } from "react"; import { BrowserRouter as Router, Route, Link } from "react-router-d 阅读全文

posted @ 2020-11-15 03:36 猫头唔食鱼 阅读(92) 评论(0) 推荐(0) 编辑

摘要:1.安装 yarn add react-router-dom 2.引入 BrowserRouter, Route, Link import React from 'react'; import { BrowserRouter as Router, Route, Link } from 'react- 阅读全文

posted @ 2020-11-15 02:43 猫头唔食鱼 阅读(240) 评论(0) 推荐(0) 编辑

摘要:1.安装 npm i mockjs -D 2.新建mockData.js import Mock from 'mockjs' export default Mock.mock('/data','get',{ // 属性 list 的值是一个数组,其中含有 1 到 10 个元素 'list|1-10' 阅读全文

posted @ 2020-11-14 18:27 猫头唔食鱼 阅读(1412) 评论(0) 推荐(0) 编辑

摘要:setState是异步的 如果想操作dom一定要在setState的回调里 例子: 获得ul里li元素的个数 import React, { Component } from 'react'; class Test extends Component { constructor(props) { s 阅读全文

posted @ 2020-11-12 17:10 猫头唔食鱼 阅读(1133) 评论(0) 推荐(0) 编辑

摘要:1.propTypes 子组件规定父组件传过来的值的类型 注意下面注释的地方 import React, { Component } from 'react'; import PropTypes from 'prop-types' // PropTypes 首字母大写 class Child ext 阅读全文

posted @ 2020-11-12 14:39 猫头唔食鱼 阅读(172) 评论(0) 推荐(0) 编辑

摘要:taro update self 阅读全文

posted @ 2020-11-07 00:05 猫头唔食鱼 阅读(512) 评论(0) 推荐(0) 编辑

摘要:import React, { Component } from "react"; import { View, Text } from "@tarojs/components"; export default class Index extends Component { constructor( 阅读全文

posted @ 2020-11-06 00:07 猫头唔食鱼 阅读(482) 评论(0) 推荐(0) 编辑

摘要:import React, { Component } from 'react' import { View, Text ,Checkbox} from '@tarojs/components' export default class Index extends Component { const 阅读全文

posted @ 2020-11-05 22:17 猫头唔食鱼 阅读(1062) 评论(0) 推荐(0) 编辑

摘要:taro的语法和react相似 import React, { Component } from 'react' import { View, Text } from '@tarojs/components' export default class Index extends Component 阅读全文

posted @ 2020-11-03 23:58 猫头唔食鱼 阅读(85) 评论(0) 推荐(0) 编辑

摘要:1.全局安装taro yarn global add @tarojs/cli 2.初始化项目 npx @tarojs/cli init project 3.运行 h5端运行命令 yarn dev:h5 自动打开 localhost:10086/#/pages/index/index 微信小程序端运行 阅读全文

posted @ 2020-11-02 01:43 猫头唔食鱼 阅读(229) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示