index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/libs/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: ['prefixCls, theme', function(prefixCls, theme) {
  28. const wrap = classNames(prefixCls, {
  29. [`${prefixCls}--${theme}`]: theme,
  30. })
  31. const left = `${prefixCls}__left`
  32. const text = `${prefixCls}__text`
  33. const title = `${prefixCls}__title`
  34. const right = `${prefixCls}__right`
  35. return {
  36. wrap,
  37. left,
  38. text,
  39. title,
  40. right,
  41. }
  42. }],
  43. },
  44. methods: {
  45. onClick(e) {
  46. const { type } = e.currentTarget.dataset
  47. this.triggerEvent('click', { type })
  48. },
  49. },
  50. })