吊带公主裙|为什么我们放弃了Vue?Vue和React深度比较( 三 )
- 芋头(React技术栈 , 推荐使用)
- wepy(Vue技术栈 , 强烈不推荐使用)
- uni-app(Vue技术栈 , 可以使用)
vue的一些周边库和Vue强绑定 , 而不是一个独立的js库的形式存在 。 导致代码难以理解 , 相关的Bug , 问题也带到了二次开发的框架中 。
这种强依赖导致的问题会给以后项目升级 , 迁移带来很多问题 。 比如vuex作为Vue的官方推荐的状态管理方案 , 只能在Vue的上面使用 , 不能在阵营上面使用 。 Redux的状态管理在阵营上用的多 , 这个却能用在Vue之上 。 类似的问题很多 , 你会发现React周围的东西可以用于Vue , Vue的东西不能用在React上 。
如果你觉得这个问题不严重 , 当你把Vue代码迁移到小程序wepy框架时发现 , wepy不支持Vuex(bug异常多) , 状态管理只能用redux , 欲哭无泪 。 同样的问题 , 如果你用的是React相关技术栈 , 反应迁移到Taro小程序框架异常简??单 , 而且可以一次性生成微信小程序 , 支付宝小程序 , 字节跳动小程序等 , 代码占用率高 。
APP生态weex , rn这块我没有比较好的实践经验 , 其中一些生产方案必须慎重考虑 。 rn比weex成熟这点是明确的 。
逻辑代码组织
import Vue, { PropOptions } from 'vue'interface User {firstName: stringlastName: number}export default Vue.extend({name: 'YourComponent',props: {user: {type: Object,required: true} as PropOptions},data () {return {message: 'This is a message'}},computed: {fullName (): string {return `${this.user.firstName} ${this.user.lastName}`}}}) API类17行import { Vue, Component, Prop } from 'vue-property-decorator'interface User {firstName: stringlastName: number}@Componentexport default class YourComponent extends Vue {@Prop({ type: Object, required: true }) readonly user!: Usermessage: string = 'This is a message'get fullName (): string {return `${this.user.firstName} ${this.user.lastName}`}}功能API 25行import Vue from 'vue'import { computed, value } from 'vue-function-api'interface User {firstName: stringlastName: number}interface YourProps {user?: User}export default Vue.extend({name: 'YourComponent',setup ({ user }: YourProps) {const fullName = computed(() => `${user.firstName} ${user.lastName}`)const message = value('This is a message')return {fullName,message}}})import React, { Component } from 'react';interface P {}interface S {}class Index extends Component{constructor(props: Readonly) {super(props);this.state = {};}static defaultProps = {};componentDidMount() {}componentDidUpdate(prevProps: Readonly) {}componentWillUnmount() {}render() {return ();}}export default Index;函数组件15行import React, { FC } from "react";interface Props {}const Index: FC= (props) => {// js 代码return ();};Index.defaultProps = {};export default Index;
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 里尚七七|乐基儿太放得开,肩宽还穿吊带显壮硕,“盔甲裙”暴露隆起肚子
- 奔驰E级|奔驰E级:开始清仓,为什么降到35万还有库存
- 烹饪|为什么大白菜上有“小黑点”?到底能不能吃?为了健康快告诉家人
- 穿搭|王丽坤又穿短裤,搭了件吊带衫,满膝盖的皱纹暴露真实年纪!
- 吊带公主裙|正式授牌!秀山(武陵)现代物流园区被授予国家电子商务示范基地
- 【渣男】乖乖女为什么会爱渣男,痛苦也不分手?
- 穿搭|张韶涵真豁得出去,薄纱上衣里只穿小吊带,配阔腿裤气质好招摇
- 鲜闻快讯|都是民国探案题材,为什么《旗袍美探》比《民国奇探》口碑差很远?
- 润杨的红楼笔记|贾母为什么不给林黛玉另择佳婿,而是坚持宝黛联姻?,元春赐礼后
- 历史的真相只有一个哦|空有做女皇的野心,而没有武则天的命,李显的漏风小棉袄安乐公主
