uni迁移到Taro

2023-12-14  本文已影响0人  NanaCti

注意uni的api使用时不需要引入uni, Taro需要导入import Taro from '@tarojs/taro'

uni.getStorage()
// =>
import Taro from '@tarojs/taro'
Taro.getStorage()
  1. 在配置中开启CSS Modules, 参考taro
<style lang="scss" scoped>
// => 
<style lang="scss" module>


class="main"
// => 
:class="$style['main']"

// 搜索框快速替换正则
class="([^"]+)"
:class="$style['$1']"

// 多类名或者原本有:class属性的需要再修改
:class="{
    [$style['class1']]: true,
    [$style['class2']]: true
  }"

image.png
上一篇 下一篇

猜你喜欢

热点阅读