index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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-empty :mode="mode">
  7. <u-button v-if="slot" slot="bottom" size="medium">
  8. slot按钮
  9. </u-button>
  10. </u-empty>
  11. </view>
  12. </view>
  13. <view class="u-config-wrap">
  14. <view class="u-config-title u-border-bottom">
  15. 参数配置
  16. </view>
  17. <view class="u-config-item">
  18. <view class="u-item-title">模式选择</view>
  19. <u-table>
  20. <u-tr class="u-tr">
  21. <u-td class="u-td">
  22. <u-button :hair-line="false" size="mini" @click="modeChange('car')">购物车为空</u-button>
  23. </u-td>
  24. <u-td class="u-td">
  25. <u-button :hair-line="false" size="mini" @click="modeChange('page')">页面不存在</u-button>
  26. </u-td>
  27. <u-td class="u-td">
  28. <u-button :hair-line="false" size="mini" @click="modeChange('search')">没有搜索结果</u-button>
  29. </u-td>
  30. </u-tr>
  31. <u-tr class="u-tr">
  32. <u-td class="u-td">
  33. <u-button :hair-line="false" size="mini" @click="modeChange('address')">没有收货地址</u-button>
  34. </u-td>
  35. <u-td class="u-td">
  36. <u-button :hair-line="false" size="mini" @click="modeChange('wifi')">没有WiFi</u-button>
  37. </u-td>
  38. <u-td class="u-td">
  39. <u-button :hair-line="false" size="mini" @click="modeChange('order')">订单为空</u-button>
  40. </u-td>
  41. </u-tr>
  42. <u-tr class="u-tr">
  43. <u-td class="u-td">
  44. <u-button :hair-line="false" size="mini" @click="modeChange('coupon')">没有优惠券</u-button>
  45. </u-td>
  46. <u-td class="u-td">
  47. <u-button :hair-line="false" size="mini" @click="modeChange('favor')">没有收藏</u-button>
  48. </u-td>
  49. <u-td class="u-td">
  50. <u-button :hair-line="false" size="mini" @click="modeChange('permission')">无权限</u-button>
  51. </u-td>
  52. </u-tr>
  53. <u-tr class="u-tr">
  54. <u-td class="u-td">
  55. <u-button :hair-line="false" size="mini" @click="modeChange('history')">无历史记录</u-button>
  56. </u-td>
  57. <u-td class="u-td">
  58. <u-button :hair-line="false" size="mini" @click="modeChange('news')">无新闻列表</u-button>
  59. </u-td>
  60. <u-td class="u-td">
  61. <u-button :hair-line="false" size="mini" @click="modeChange('message')">消息列表为空</u-button>
  62. </u-td>
  63. </u-tr>
  64. <u-tr class="u-tr">
  65. <u-td class="u-td">
  66. <u-button :hair-line="false" size="mini" @click="modeChange('list')">列表为空</u-button>
  67. </u-td>
  68. <u-td class="u-td">
  69. <u-button :hair-line="false" size="mini" @click="modeChange('data')">数据为空</u-button>
  70. </u-td>
  71. <u-td class="u-td">
  72. 待扩展
  73. </u-td>
  74. </u-tr>
  75. </u-table>
  76. </view>
  77. <view class="u-config-item">
  78. <view class="u-item-title">传入slot</view>
  79. <u-subsection current="1" :list="['是', '否']" @change="slotChange"></u-subsection>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. mode: 'data',
  89. slot: false
  90. }
  91. },
  92. methods: {
  93. modeChange(mode = 'data') {
  94. this.mode = mode;
  95. },
  96. slotChange(index) {
  97. this.slot = !index;
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .u-demo-area {
  104. height: 160px;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. }
  109. .u-demo-area .u-empty {
  110. padding-top: 0;
  111. }
  112. </style>