You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

144 lines
5.4 KiB

  1. <template>
  2. <view>
  3. <l-title>宫格列表:</l-title>
  4. <l-select v-model="gridCol" :range="[3, 4, 5]" title="选择宫格的列数" />
  5. <l-switch v-model="gridBorder" title="是否显示边框" />
  6. <view :class="['col-' + gridCol, gridBorder ? '' : 'no-border']" class="cu-list grid">
  7. <view v-for="(item, index) in gridList" :key="index" class="cu-item">
  8. <l-icon :type="item.icon" :color="item.color" />
  9. <l-tag badge v-if="item.badge">{{ item.badge }}</l-tag>
  10. <text>{{ item.name }}</text>
  11. </view>
  12. </view>
  13. <l-demo-description>
  14. 外部容器添加 class="cu-list grid col-*" 并将*替换为列数(一般为3~5),内部容器添加 class="cu-item";
  15. 外部容器添加类名 no-border 即可设为无边框宫格
  16. </l-demo-description>
  17. <l-title>菜单列表:</l-title>
  18. <view class="bg-gray">
  19. <l-switch v-model="menuCard" title="卡片轮廓型列表" />
  20. <l-list :card="menuCard">
  21. <l-list-item title="基础型列表项" />
  22. <l-list-item title="带有箭头的列表项" arrow />
  23. <l-list-item>
  24. <l-icon type="emoji" color="red" />
  25. 定制内容的列表项
  26. <text slot="action">
  27. 我是右侧的文字~
  28. </text>
  29. </l-list-item>
  30. <l-list-item title="带按钮的列表项">
  31. <l-button slot="action" color="green" shadow>我是按钮</l-button>
  32. </l-list-item>
  33. <l-list-item title="带标签的列表项">
  34. <text slot="action">
  35. <l-tag color="red" round>标签1</l-tag>
  36. <l-tag color="olive" round>标签2</l-tag>
  37. <l-tag color="blue" round>标签3</l-tag>
  38. </text>
  39. </l-list-item>
  40. <l-list-item title="多行列表项">
  41. <view>多行列表项</view>
  42. <view slot="extra" class="text-gray text-sm">
  43. <l-icon type="infofill" />
  44. 我是Tips文字
  45. </view>
  46. </l-list-item>
  47. </l-list>
  48. </view>
  49. <l-demo-description>
  50. 列表外侧使用 l-list 标签,添加 card 属性转为卡片轮廓列表;列表项使用 l-list-item 标签; 列表项添加 arrow
  51. 属性可以设置箭头; 列表项可以添加以下属性:title、action,分别表示列表项左侧标题、列表项右侧内容;
  52. 默认插槽的内容将渲染为列表项的 title 标题内容;名为 action 的插槽内容渲染到列表项右侧; 名为 extra
  53. 的插槽内容将渲染到列表项的标题下方
  54. </l-demo-description>
  55. <l-title>消息列表:</l-title>
  56. <l-list message>
  57. <l-list-item
  58. avatar="https://img.learun.cn/wxcx/pic.jpg"
  59. title="王小明"
  60. extra="消息内容消息内容消息内容消息内容消息内容"
  61. time="22:04"
  62. />
  63. <l-list-item title="王小明" extra="消息内容消息内容消息内容消息内容消息内容" time="22:04">
  64. <l-avatar slot="avatar" src="https://img.learun.cn/wxcx/pic.jpg" size="lg">
  65. <l-tag slot="badge" color="red" badge round>5</l-tag>
  66. </l-avatar>
  67. </l-list-item>
  68. <l-list-item
  69. avatar="https://img.learun.cn/wxcx/pic.jpg"
  70. extra="消息内容消息内容消息内容消息内容消息内容"
  71. time="22:04"
  72. >
  73. <text class="text-red">王小明</text>
  74. <l-tag color="red" class="margin-left-sm" light round>新消息</l-tag>
  75. </l-list-item>
  76. <l-list-item
  77. title="王小明"
  78. avatar="https://img.learun.cn/wxcx/pic.jpg"
  79. extra="消息内容消息内容消息内容消息内容消息内容"
  80. time="22:04"
  81. >
  82. <text slot="extra">
  83. 我在
  84. <l-icon type="locationfill" color="orange" />
  85. 苏州市
  86. </text>
  87. </l-list-item>
  88. <l-list-item
  89. title="王小明"
  90. avatar="https://img.learun.cn/wxcx/pic.jpg"
  91. extra="消息内容消息内容消息内容消息内容消息内容"
  92. time="22:04"
  93. >
  94. <text slot="tips">
  95. <l-icon type="notice_forbid_fill" color="gray" size="lg" />
  96. </text>
  97. </l-list-item>
  98. </l-list>
  99. <l-demo-description>
  100. 在 l-list 列表标签上添加 message 属性即可将列表设为消息列表;列表项仍是 l-list-item 标签;
  101. 标签可以设置以下属性:avatar、title、extra、time、tips;
  102. 这些属性依次表示:头像地址、消息标题、消息内容、发送时间、消息额外提示(显示在时间下面); 其中
  103. avatar、title、extra、time、tips 属性的内容均可使用同名的插槽来渲染
  104. </l-demo-description>
  105. </view>
  106. </template>
  107. <script>
  108. export default {
  109. data() {
  110. return {
  111. gridCol: 3,
  112. gridBorder: false,
  113. menuArrow: false,
  114. menuCard: false,
  115. gridList: [
  116. { icon: 'cardboardfill', color: 'red', badge: 120, name: 'VR' },
  117. { icon: 'recordfill', color: 'orange', badge: 1, name: '录像' },
  118. { icon: 'picfill', color: 'yellow', name: '图像' },
  119. { icon: 'noticefill', color: 'olive', badge: 22, name: '通知' },
  120. { icon: 'upstagefill', color: 'cyan', name: '排行榜' },
  121. { icon: 'clothesfill', color: 'blue', name: '皮肤' },
  122. { icon: 'discoverfill', color: 'purple', name: '发现' },
  123. { icon: 'questionfill', color: 'mauve', name: '帮助' },
  124. { icon: 'commandfill', color: 'purple', name: '问答' },
  125. { icon: 'brandfill', color: 'mauve', name: '版权' }
  126. ]
  127. }
  128. }
  129. }
  130. </script>