Commit 3a164d38 authored by 谢卓城's avatar 谢卓城

完善:提供组件内部使用全局样式

parent 9c045c36
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
@import './scss/variables.scss'; @import './scss/variables.scss';
@import './scss/style.scss'; @import './scss/style.scss';
.container{ .container{
width: 100%; width: 100%;
height: 100vh; height: 100vh;
......
/**
* 除继承样式外, app.wxss 中的样式、组件所在页面的的样式对自定义组件无效。
* 参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html
* 采用 externalClasses 的方式 在组件.wxml需要的view的class加super-class,可以是多个
* 使用 <Component super-class="<#type#>" />
*/
Component({ Component({
properties: { properties: {
showDelect: Boolean, showDelect: Boolean,
flexList: Array, flexList: Array,
title: String // 简化的定义方式 title: String // 简化的定义方式
}, },
externalClasses: ["super-class"],
data: { data: {
content: "content" content: "content"
}, },
......
<!--template/components/index.wxml--> <!--template/components/index.wxml-->
<view class="container" hover-class="none" hover-stop-propagation="false"> <view class="container" hover-class="none" hover-stop-propagation="false">
<text class="flex-item" selectable="false" space="false" decode="false" bindtap="tagAction" data-text="{{content}}">{{content}}</text> <text class="flex-item super-class" selectable="false" space="false" decode="false" bindtap="tagAction" data-text="{{content}}">{{content}}</text>
</view> </view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment