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

wxplugin框架第三方组件库的样式无效 #4736

Closed
guxingke201 opened this issue Oct 31, 2019 · 4 comments
Closed

wxplugin框架第三方组件库的样式无效 #4736

guxingke201 opened this issue Oct 31, 2019 · 4 comments
Assignees

Comments

@guxingke201
Copy link
Contributor

问题描述
wxplugin框架第三方组件库的样式无效
复现步骤
[复现问题的步骤]

  1. taro创建wxplugin脚手架
  2. avatar.tsx加入taro-ui组件
  3. avatar.scss加入样式
  4. 运行taro build --plugin weapp
  5. 运行taro build --type weapp
  6. 用微信工具打开预览页面发现样式没生效
    7.如果把avatar.scss的样式放到app.scss里可以生效
import Taro, { Component } from '@tarojs/taro'
import { AtAvatar, AtButton } from 'taro-ui'
import { View } from '@tarojs/components'
import './avatar.scss'

export default class Avatar extends Component {
  render() {
    return (
      <View>
        <View className="testclass">aaa</View>
        <AtAvatar
          circle
          image='http://storage.360buyimg.com/taro-static/static/images/logo.png'></AtAvatar>
        <AtButton type='primary'>primary</AtButton>
        <AtButton type='primary'>primary</AtButton>
        <AtButton type='primary'>primary</AtButton>
      </View>
    )
  }
}
@import '~taro-ui/dist/style/variables/default.scss';
@import '~taro-ui/dist/style/mixins/index.scss';
@import '~taro-ui/dist/style/components/button.scss';
@import '~taro-ui/dist/style/components/avatar.scss';

期望行为
avatar.scss加入第三方组件样式可以生效,且没有异常信息
报错信息
异常信息应该和样式无效无关,但还是希望能处理下
image

系统信息
👽 Taro v1.3.18

Taro CLI 1.3.18 environment info:
System:
OS: Windows 10
Binaries:
Node: 9.8.0 - H:\node\nodejs\node.EXE
npm: 5.6.0 - H:\node\nodejs\npm.CMD

补充信息
看过编译后的wxss存在样式,但是没生效,有可能是微信插件语法的bug

@taro-bot
Copy link

taro-bot bot commented Oct 31, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Chen-jj Chen-jj self-assigned this Oct 31, 2019
@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 14, 2019

@guxingke201 报错是 appid 没填好,仔细看看插件部分的文档吧。

@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 14, 2019

#4117

你写的是“插件页面”,taro-ui 组件都配置了 addGlobalClass,所以 taro-ui 组件的样式可以从页面 wxss 获取。但如果写的是“插件组件”,则会没有样式,正如我一开始向你确定是否有样式。因此如果你需要写“插件组件”,则只能直接拿 taro-ui 组件源码了。

@Chen-jj Chen-jj closed this as completed Nov 14, 2019
@guxingke201
Copy link
Contributor Author

样式丢了如果是小程序的问题,那还可以选整包引入样式,不至于拿源码了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants