wux-weapp
Version:
一套组件化、可复用、易扩展的微信小程序 UI 组件库
53 lines (50 loc) • 1.27 kB
JavaScript
import baseComponent from '../helpers/baseComponent'
import classNames from '../helpers/libs/classNames'
baseComponent({
properties: {
prefixCls: {
type: String,
value: 'wux-navbar',
},
theme: {
type: String,
value: 'light',
},
title: {
type: String,
value: '',
},
leftText: {
type: String,
value: '',
},
rightText: {
type: String,
value: '',
},
},
computed: {
classes: ['prefixCls, theme', function(prefixCls, theme) {
const wrap = classNames(prefixCls, {
[`${prefixCls}--${theme}`]: theme,
})
const left = `${prefixCls}__left`
const text = `${prefixCls}__text`
const title = `${prefixCls}__title`
const right = `${prefixCls}__right`
return {
wrap,
left,
text,
title,
right,
}
}],
},
methods: {
onClick(e) {
const { type } = e.currentTarget.dataset
this.triggerEvent('click', { type })
},
},
})