index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. baseComponent({
  4. properties: {
  5. prefixCls: {
  6. type: String,
  7. value: 'wux-navbar',
  8. },
  9. theme: {
  10. type: String,
  11. value: 'light',
  12. },
  13. title: {
  14. type: String,
  15. value: '',
  16. },
  17. leftText: {
  18. type: String,
  19. value: '',
  20. },
  21. rightText: {
  22. type: String,
  23. value: '',
  24. },
  25. },
  26. computed: {
  27. classes() {
  28. const { prefixCls, theme } = this.data
  29. const wrap = classNames(prefixCls, {
  30. [`${prefixCls}--${theme}`]: theme,
  31. })
  32. const left = `${prefixCls}__left`
  33. const text = `${prefixCls}__text`
  34. const title = `${prefixCls}__title`
  35. const right = `${prefixCls}__right`
  36. return {
  37. wrap,
  38. left,
  39. text,
  40. title,
  41. right,
  42. }
  43. },
  44. },
  45. methods: {
  46. onClick(e) {
  47. const { type } = e.currentTarget.dataset
  48. this.triggerEvent('click', { type })
  49. },
  50. },
  51. })