1.安裝javascript
(1)安裝腳手架css
npm install -g @tarojs/cli taro init myApp
(2)H5端運行java
npm run dev:h5 taro build --type h5 --watch
(3)微信小程序端運行npm
npm run dev:weapp taro build --type weapp --watch
2.語法小程序
import Taro, { Component } from '@tarojs/taro' import Index from './pages/index' import './app.scss' class App extends Component { // 項目配置 config = { pages: [ 'pages/index/index' ], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', navigationBarTextStyle: 'black' } } componentWillMount () {} componentDidMount () {} componentDidShow () {} componentDidHide () {} render () { return ( <Index /> ) } }
3.demo微信小程序