Yao 66d6f4fc03
[improvement] 增加部分组件自定义样式类,方便自定义样式 (#352)
* 增加自定义样式类,并开放部分,在文档上体现

* 增加 cell 外部样式类说明

* 增加自定义样式类
2018-07-10 16:25:47 +08:00

59 lines
1022 B
JavaScript

const nativeButtonBehavior = require('./native-button-behaviors');
Component({
externalClasses: ['custom-class', 'theme-class'],
behaviors: [nativeButtonBehavior],
relations: {
'../btn-group/index': {
type: 'parent',
linked() {
this.setData({ inGroup: true });
},
unlinked() {
this.setData({ inGroup: false });
}
}
},
properties: {
type: {
type: String,
value: '',
},
size: {
type: String,
value: '',
},
plain: {
type: Boolean,
value: false,
},
disabled: {
type: Boolean,
value: false,
},
loading: {
type: Boolean,
value: false,
}
},
data: {
inGroup: false,
isLast: false
},
methods: {
handleTap() {
if (this.data.disabled) {
this.triggerEvent('disabledclick')
return;
}
this.triggerEvent('btnclick');
},
switchLastButtonStatus(isLast = false) {
this.setData({ isLast });
}
}
});