Taro文档笔记
路由 https://taro-docs.jd.com/taro/docs/router
Taro.getCurrentInstance().router.params
静态资源引用
css,js,图片文件。。。
Taro 默认会对 1kb 大小以下的资源进行转换
https://taro-docs.jd.com/taro/docs/static-reference
框架CLI 的常用命令
https://taro-docs.jd.com/taro/docs/cli
HTML标签 Taro v3.3+ 开始支持
!!直接使用html结构写法
从原生小程序迁移过来
渲染html
html字符串渲染在小程序View标签上
https://taro-docs.jd.com/taro/docs/html
插件功能 ? Taro暂时没用上
Taro的操作小程序DOM结构API
jQuery-like API
https://taro-docs.jd.com/taro/docs/jquery-like
Taro的性能优化
https://taro-docs.jd.com/taro/docs/optimized
setData()
。。。。。。
删除楼层节点要谨慎处理,外层套个View
基础组件的属性要保持引用,尽量使用this.state.xxxx写在DOM标签结构上
基础组件不要挂载额外属性(View, Input,Text。。。不要添加自定义属性)
使用微信小程序原生组件
https://taro-docs.jd.com/taro/docs/hybrid
事件绑定:react -- onClick={this.handleClick} vue -- @click='handleClick'
slot
| react | vue |
| <Slot> </Slot> | <slot-view> </slot-view> |
获取第三方组件实例
import { getCurrentInstance } from '@tarojs/taro'
const { page } = getCurrentInstance()
page.selectComponent('#mychart-dom-area')
使用小程序插件
在原生小程序项目中,引入Taro使用
https://taro-docs.jd.com/taro/docs/taro-in-miniapp
https://taro-docs.jd.com/taro/docs/redux
Redux
腾讯埋点,百度统计

浙公网安备 33010602011771号