Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taroify引入全局样式无法生效 #16423

Open
CHANxw opened this issue Aug 29, 2024 · 0 comments
Open

taroify引入全局样式无法生效 #16423

CHANxw opened this issue Aug 29, 2024 · 0 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@CHANxw
Copy link

CHANxw commented Aug 29, 2024

相关平台

微信小程序

复现仓库

https://gitee.com/mychanxw/find-partner.git
小程序基础库: 3.5.5
使用框架: React

复现步骤

实际taro版本为4.0.5

  1. taro init 项目后

  2. pnpm 添加 @taroify/core

  3. 在/src/pages/index/index.tsx 文件下添加测试代码

    <Button color="primary">测试</Button>
    <Cell title="单元格">内容</Cell>
    <Cell title="单元格" brief="描述信息">
      内容
    </Cell>
    
    
  4. 在 src/app.ts 下引入
    import "@taroify/core/index.scss" // 引入taroify全局样式

  5. 启动 pnpm dev:wxapp 和 pnpm dev:h5

  6. 微信开发工具项目指定的是根目录 非dist目录

期望结果

h5及微信开发工具可正常渲染taroify样式

实际结果

查看首页-即pages/index页面
h5上显示正常

  1. 微信小程序开发工具 wxml显示正常,但无样式,绑定的class正确;
  2. 查看dist内文件
    vendors.wxss 内有相关class css内容,但无效果;

环境信息

  Taro v4.0.5

  Taro CLI 4.0.5 environment info:
    System:
      OS: macOS 13.6.7
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.17.0 - ~/.n/bin/node
      npm: 10.8.2 - ~/.n/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.5 => 4.0.5 
      @tarojs/components: 4.0.5 => 4.0.5 
      @tarojs/helper: 4.0.5 => 4.0.5 
      @tarojs/plugin-framework-react: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-alipay: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-h5: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-harmony-hybrid: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-jd: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-qq: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-swan: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-tt: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-weapp: 4.0.5 => 4.0.5 
      @tarojs/react: 4.0.5 => 4.0.5 
      @tarojs/runtime: 4.0.5 => 4.0.5 
      @tarojs/shared: 4.0.5 => 4.0.5 
      @tarojs/taro: 4.0.5 => 4.0.5 
      @tarojs/vite-runner: 4.0.5 => 4.0.5 
      babel-preset-taro: 4.0.5 => 4.0.5 
      eslint-config-taro: 4.0.5 => 4.0.5 
      react: ^18.0.0 => 18.3.1 
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Aug 29, 2024
This was referenced Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

No branches or pull requests

1 participant