摘要: 在vue中使用模板来创建你的html h()函数是一个用于创建vnode的一个函数。 类似于react中的jsx语法 阅读全文
posted @ 2022-02-20 15:21 无何不可88 阅读(1096) 评论(0) 推荐(0)
摘要: 查看远程所有分支 $ git branch -a 创建分支 git branch [branchname] 新建分支并切换到指定分支 git checkout -b master origin/master git checkout -b 本地分支名 origin/远程分支名使用上面的命令可以创建分 阅读全文
posted @ 2022-02-14 10:54 无何不可88 阅读(2593) 评论(0) 推荐(0)
摘要: 第一个参数:props 第二个参数:context context有attrs,slots,emit setup(props,{attrs,slots,emit}){ console.log(props.message); console.log(attrs.id,attrs.class); con 阅读全文
posted @ 2022-02-11 08:20 无何不可88 阅读(773) 评论(0) 推荐(0)
摘要: 数组方法 返回新数组 concat() 连接两个或更多的数组,并返回结果 let arr = [1,2,3,4]; let newArr = arr.concat([5,6],7); console.log(newArr); // [1,2,3,4,5,6,7] console.log(arr); 阅读全文
posted @ 2022-02-09 22:05 无何不可88 阅读(93) 评论(0) 推荐(0)
摘要: import React, { Component } from 'react' export default class Input extends Component { constructor(props){ super(props); this.state={ username:"" } } 阅读全文
posted @ 2022-01-16 17:56 无何不可88 阅读(29) 评论(0) 推荐(0)
摘要: 在react中。不建议直接操作DOM元素。 在元素上使用ref,可以传字符串,对象,函数。官方推荐对象 字符串方法: <h2 ref="titleRef">字符串方法</h2> <button onClick={e=>this.changText()}>改变文本</button> changText 阅读全文
posted @ 2022-01-16 17:04 无何不可88 阅读(222) 评论(0) 推荐(0)
摘要: 第一步:安装events依赖 yarn add events //通过yarn安装npm add events //通过npm安装 第二步:在App.js中引入events import { EventEmitter} from 'events' 第三步:创建一个变量 //事件总线events bu 阅读全文
posted @ 2022-01-16 14:21 无何不可88 阅读(596) 评论(0) 推荐(0)
摘要: 通过案例展示问题:一个添加用户信息的案例 import React from 'react' import './App.css' class App extends React.Component { constructor(props){ super(props); this.state = { 阅读全文
posted @ 2022-01-11 20:44 无何不可88 阅读(37) 评论(0) 推荐(0)
摘要: <h2> <ul> { this.state.movies.map((item,index)=>{ return <li>{item}</li> }) } </ul> <button onClick={e=>this.insertMovie()}>添加电影</button> </h2> 点击按钮往前 阅读全文
posted @ 2022-01-10 21:51 无何不可88 阅读(44) 评论(0) 推荐(0)
摘要: 数据展示 constructor(props){ super(props); this.state={ name:['流行','新款','精选'], currentTitle:'流行', increment:"Hello,World", title:'coderWhy' } } render(){ 阅读全文
posted @ 2022-01-09 13:25 无何不可88 阅读(319) 评论(0) 推荐(0)