Watch 8 Star 4 Fork 3

magicodes / Magicodes.MiniprogramTypeScriptApache-2.0

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Magicodes框架之小程序前端框架 spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Magicodes.Miniprogram

项目介绍

Magicodes框架之小程序前端框架

软件架构

基于Taro+Dva 的多端开发解决方案

学习资源

此框架需要es2015基础

DvaJs

完整的案例参考

awesome-taro

Taro 特性

React 语法风格

Taro 的语法规则基于 React 规范,它采用与 React 一致的组件化思想,组件生命周期与 React 保持一致,同时在书写体验上也尽量与 React 类似,支持使用 JSX 语法,让代码具有更丰富的表现力。

代码示例

import Taro, { Component } from '@tarojs/taro'
import { View, Button } from '@tarojs/components'

export default class Index extends Component {
  constructor () {
    super(...arguments)
    this.state = {
      title: '首页',
      list: [1, 2, 3]
    }
  }

  componentWillMount () {}

  componentDidMount () {}

  componentWillUpdate (nextProps, nextState) {}

  componentDidUpdate (prevProps, prevState) {}

  shouldComponentUpdate (nextProps, nextState) {
    return true
  }

  add = (e) => {
    // dosth
  }

  render () {
    return (
      <View className='index'>
        <View className='title'>{this.state.title}</View>
        <View className='content'>
          {this.state.list.map(item => {
            return (
              <View className='item'>{item}</View>
            )
          })}
          <Button className='add' onClick={this.add}>添加</Button>
        </View>
      </View>
    )
  }
}

安装教程

  1. npm i
  2. npm start (默认h5,具体命令见scripts)

Comments ( 0 )

Sign in for post a comment

TypeScript
1
https://gitee.com/magicodes/Magicodes.Miniprogram.git
git@gitee.com:magicodes/Magicodes.Miniprogram.git
magicodes
Magicodes.Miniprogram
Magicodes.Miniprogram
master

Help Search