Vue于React特性简单对比(一)
一,对象实体对比 vue的对象实体依然是html,而react的对象实体已经变味jsx,一种新的语法结构。 vue的html与react的jsx都可以进行拆分,拆分成更细小的组件,组件之间可以传值。 二,生命周期 显然二者都有生命周期概念,生命周期让静态对象实体变为动态实体。 vue的生命周期: beforeCreate created beforeMount mounted beforeDestroy destroyed react的生命周期 constructor componentWillMount render() componentDidMount componentWillReceiveProps shouldComponentUpdate componentWillUpdata render() componentDidUpdate() componentWillUnmount() 三,修改系统 修改系统第一步是赋值,因为不管是html还是jsx都只是一个结构,没有数据的结构,所以第一步是赋予数据。 赋予数据的方式有 vue data是数据集合 v-for,v-if,v-show,v-else,v-else-if,v-bind,v-on,refs,{{}},props; react 在es6中,可以在this.state中产生初始化数据