index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="u-demo">
  3. <view class="u-demo-wrap">
  4. <view class="u-demo-title">演示效果</view>
  5. <view class="u-demo-area">
  6. <u-subsection v-if="change" :bold="bold" :active-color="activeColor" :current="current" :mode="mode" :list="['代付款', '待收货', '待评价']"></u-subsection>
  7. </view>
  8. </view>
  9. <view class="u-config-wrap">
  10. <view class="u-config-title u-border-bottom">
  11. 参数配置
  12. </view>
  13. <view class="u-config-item">
  14. <view class="u-item-title">模式选择(为满足演示需要,切换会有抖动,非性能问题)</view>
  15. <u-subsection mode="button" :list="['button', 'subsection']" @change="modeChange"></u-subsection>
  16. </view>
  17. <view class="u-config-item">
  18. <view class="u-item-title">Current值</view>
  19. <u-subsection mode="button" :list="[0, 1, 2]" @change="currentChange"></u-subsection>
  20. </view>
  21. <view class="u-config-item">
  22. <view class="u-item-title">活动选项字颜色</view>
  23. <u-subsection mode="button" :list="['primary', 'success', 'error', 'warning']" @change="colorChange"></u-subsection>
  24. </view>
  25. <view class="u-config-item">
  26. <view class="u-item-title">字体加粗</view>
  27. <u-subsection mode="button" :list="['是', '否']" @change="boldChange"></u-subsection>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. mode: 'button',
  37. current: 0,
  38. activeColor: this.$u.color['warning'],
  39. bold: true,
  40. change: true,
  41. }
  42. },
  43. methods: {
  44. modeChange(e) {
  45. switch(e) {
  46. case 0:
  47. this.mode = 'button';break;
  48. case 1:
  49. this.mode = 'subsection';break;
  50. }
  51. this.change = false;
  52. this.$nextTick(() => {
  53. this.change = true;
  54. })
  55. },
  56. currentChange(e) {
  57. this.current = e;
  58. },
  59. colorChange(e) {
  60. let color = 'primary';
  61. switch(e) {
  62. case 0:
  63. color = 'primary';break;
  64. case 1:
  65. color = 'success';break;
  66. case 2:
  67. color = 'error';break;
  68. case 3:
  69. color = 'warning';break;
  70. }
  71. this.activeColor = this.$u.color[color];
  72. },
  73. boldChange(e) {
  74. switch(e) {
  75. case 0:
  76. this.bold = true;break;
  77. case 1:
  78. this.bold = false;break;
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .u-demo {}
  86. </style>