index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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-section :title="title" :right="right" :bold="bold" :color="color" :show-line="showLine"></u-section>
  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 :current="1" :list="['是', '否']" @change="titleChange"></u-subsection>
  16. </view>
  17. <view class="u-config-item">
  18. <view class="u-item-title">竖条状态</view>
  19. <u-subsection :list="['显示', '隐藏']" @change="showLineChange"></u-subsection>
  20. </view>
  21. <view class="u-config-item">
  22. <view class="u-item-title">是否显示右边部分</view>
  23. <u-subsection :list="['是', '否']" @change="rightChange"></u-subsection>
  24. </view>
  25. <view class="u-config-item">
  26. <view class="u-item-title">主标题粗体</view>
  27. <u-subsection :list="['是', '否']" @change="boldChange"></u-subsection>
  28. </view>
  29. <view class="u-config-item">
  30. <view class="u-item-title">主标题颜色</view>
  31. <u-subsection :list="['默认', '自定义']" @change="colorChange"></u-subsection>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. title: '红豆生南国',
  41. bold: true,
  42. right: true,
  43. color: this.$u.color['mainColor'],
  44. showLine: true
  45. }
  46. },
  47. methods: {
  48. titleChange(index) {
  49. if(index == 0) this.title = '春来发几枝';
  50. else this.title = '红豆生南国';
  51. },
  52. rightChange(index) {
  53. this.right = index == 0 ? true : false;
  54. },
  55. boldChange(index) {
  56. this.bold = index == 0 ? true : false;
  57. },
  58. colorChange(index) {
  59. this.color = index == 0 ? this.$u.color['mainColor'] : this.$u.color['primary'];
  60. },
  61. showLineChange(index) {
  62. this.showLine = !index;
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .u-demo {}
  69. </style>