Taro: Vue多页面多组件时样式未引入

Created on 6 Aug 2020  ·  3Comments  ·  Source: NervJS/taro


相关平台

微信小程序

复现仓库

https://github.com/tenbamboo/taroerror
小程序基础库: 2.12.1
使用框架: Vue 2

复现步骤

  1. clone 项目&启动

2.查看src/components/下的 BasicContainer.vue (css=>color:red)和 Comp1.vue (css=>color:blud)样式是否加载成功

期望结果

组件内的文字颜色是对应的红色和蓝色

实际结果

未显示任何颜色
image

环境信息

  Taro CLI 3.0.7 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 10.8.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.15.2 - C:\Users\***\AppData\Roaming\npm\yarn.CMD
      npm: 6.2.0 - C:\Program Files\nodejs\npm.CMD

补充信息

初步分析,是dist/common.wxss 文件未加载到全局样式中

image

分支描述

如果把app.config.js中的 pages的 'pages/index2/index'注释之后,再次重新启动服务(yarn dev:weapp),颜色就会有了如下图:

image

F-vue2 T-weapp V-3

Most helpful comment

嗯嗯,已经提 fix 这个问题了,后面拉 template 会自动加上。

All 3 comments

App.js 里面要把 app.scss 传入,不然 common.wxss 不能全局打包进小程序代码里

// app.js
import './app.scss'

确实,我刚刚引入app.scss马上好用了。。。,谢谢

嗯嗯,已经提 fix 这个问题了,后面拉 template 会自动加上。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rainbowMorelhahahah picture rainbowMorelhahahah  ·  3Comments

GreatAuk picture GreatAuk  ·  3Comments

qilovehua picture qilovehua  ·  3Comments

wyhaya picture wyhaya  ·  3Comments

ruixiu picture ruixiu  ·  3Comments