index.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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-toast ref="uToast"></u-toast>
  7. <u-table :align="align" :borderColor="borderColor">
  8. <u-tr class="u-tr">
  9. <u-th class="u-th">姓名</u-th>
  10. <u-th class="u-th">年龄</u-th>
  11. <u-th class="u-th">籍贯</u-th>
  12. <u-th class="u-th">性别</u-th>
  13. </u-tr>
  14. <u-tr class="u-tr">
  15. <u-td class="u-td">吕布</u-td>
  16. <u-td class="u-td">22</u-td>
  17. <u-td class="u-td">楚河</u-td>
  18. <u-td class="u-td">男</u-td>
  19. </u-tr>
  20. <u-tr class="u-tr">
  21. <u-td class="u-td">项羽</u-td>
  22. <u-td class="u-td">28</u-td>
  23. <u-td class="u-td">汉界</u-td>
  24. <u-td class="u-td">男</u-td>
  25. </u-tr>
  26. <u-tr class="u-tr">
  27. <u-td class="u-td">木兰</u-td>
  28. <u-td class="u-td">24</u-td>
  29. <u-td class="u-td">南国</u-td>
  30. <u-td class="u-td">女</u-td>
  31. </u-tr>
  32. </u-table>
  33. </view>
  34. </view>
  35. <view class="u-config-wrap">
  36. <view class="u-config-title u-border-bottom">
  37. 参数配置
  38. </view>
  39. <view class="u-config-item">
  40. <view class="u-item-title">边框颜色</view>
  41. <u-subsection :list="['gray', 'primary', 'warning']" @change="borderColorChange"></u-subsection>
  42. </view>
  43. <view class="u-config-item">
  44. <view class="u-item-title">对齐方式</view>
  45. <u-subsection current="1" :list="['左', '中', '右']" @change="alignChange"></u-subsection>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. mode: false,
  55. borderColor: '#e4e7ed',
  56. align: 'center',
  57. index: 0,
  58. }
  59. },
  60. methods: {
  61. modeChange(index) {
  62. // #ifdef MP-WEIXIN
  63. return this.$u.toast('微信小程序暂不支持单元格合并')
  64. // #endif
  65. this.mode = index == 0 ? true : false;
  66. this.key ++;
  67. },
  68. borderColorChange(index) {
  69. this.borderColor = index == 0 ? '#e4e7ed' : index == 1 ? '#2979ff' : '#ff9900';
  70. },
  71. alignChange(index) {
  72. this.align = index == 0 ? 'left' : index == 1 ? 'center' : 'right';
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .wrap {
  79. padding: 24rpx;
  80. }
  81. </style>