wux-weapp
Version:
一套组件化、可复用、易扩展的微信小程序 UI 组件库
48 lines (45 loc) • 1.25 kB
JavaScript
import baseComponent from '../helpers/baseComponent'
import classNames from '../helpers/libs/classNames'
baseComponent({
properties: {
prefixCls: {
type: String,
value: 'wux-divider',
},
position: {
type: String,
value: 'center',
},
dashed: {
type: Boolean,
value: false,
},
text: {
type: String,
value: '',
},
showText: {
type: Boolean,
value: true,
},
direction: {
type: String,
value: 'horizontal',
},
},
computed: {
classes: ['prefixCls, dashed, showText, position, direction', function(prefixCls, dashed, showText, position, direction) {
const wrap = classNames(prefixCls, {
[`${prefixCls}--dashed`]: dashed,
[`${prefixCls}--text`]: showText,
[`${prefixCls}--text-${position}`]: showText && position,
[`${prefixCls}--${direction}`]: direction,
})
const text = `${prefixCls}__text`
return {
wrap,
text,
}
}],
},
})