index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="">
  3. <view class="u-card-wrap">
  4. <u-card @click="click" @head-click="headClick" :title="title" :sub-title="subTitle" :thumb="thumb" :padding="padding" :border="border">
  5. <view class="" slot="body">
  6. <view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
  7. <view class="u-body-item-title u-line-2">
  8. 瓶身描绘的牡丹一如你初妆,冉冉檀香透过窗心事我了然,宣纸上走笔至此搁一半
  9. </view>
  10. <image src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg" mode="aspectFill"></image>
  11. </view>
  12. <view class="u-body-item u-flex u-row-between u-p-b-0">
  13. <view class="u-body-item-title u-line-2">
  14. 釉色渲染仕女图韵味被私藏,而你嫣然的一笑如含苞待放
  15. </view>
  16. <image src="https://img12.360buyimg.com/n7/jfs/t1/102191/19/9072/330688/5e0af7cfE17698872/c91c00d713bf729a.jpg" mode="aspectFill"></image>
  17. </view>
  18. </view>
  19. <view class="" slot="foot">
  20. <u-icon v-if="bottomSlot" name="chat-fill" size="34" label="30评论"></u-icon>
  21. </view>
  22. </u-card>
  23. </view>
  24. <view class="u-config-wrap u-demo">
  25. <view class="u-config-title u-border-bottom">
  26. 参数配置
  27. </view>
  28. <view class="u-config-item">
  29. <view class="u-item-title">左上角图标</view>
  30. <u-subsection :list="['显示', '隐藏']" @change="thumbChange"></u-subsection>
  31. </view>
  32. <view class="u-config-item">
  33. <view class="u-item-title">内边距</view>
  34. <u-subsection current="1" :list="['20', '30', '40']" @change="paddingChange"></u-subsection>
  35. </view>
  36. <view class="u-config-item">
  37. <view class="u-item-title">底部</view>
  38. <u-subsection :list="['显示', '隐藏']" @change="bottomChange"></u-subsection>
  39. </view>
  40. <view class="u-config-item">
  41. <view class="u-item-title">外边框</view>
  42. <u-subsection :list="['显示', '隐藏']" @change="borderChange"></u-subsection>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. title: '素胚勾勒出青花,笔锋浓转淡',
  52. subTitle: '2020-05-15',
  53. thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
  54. padding: 20,
  55. bottomSlot: true,
  56. border: true
  57. }
  58. },
  59. methods: {
  60. thumbChange(index) {
  61. this.thumb = index == 0 ? 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg' : '';
  62. },
  63. paddingChange(index) {
  64. this.padding = [20, 30, 40][index];
  65. },
  66. bottomChange(index) {
  67. this.bottomSlot = !index;
  68. },
  69. borderChange(index) {
  70. this.border = !index;
  71. },
  72. click(index) {
  73. console.log(index);
  74. },
  75. headClick(index) {
  76. console.log(index);
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .u-demo {
  83. padding-top: 0;
  84. }
  85. .u-card-wrap {
  86. background-color: $u-bg-color;
  87. padding: 1px;
  88. }
  89. .u-body-item {
  90. font-size: 32rpx;
  91. color: #333;
  92. padding: 20rpx 10rpx;
  93. }
  94. .u-body-item image {
  95. width: 120rpx;
  96. flex: 0 0 120rpx;
  97. height: 120rpx;
  98. border-radius: 8rpx;
  99. margin-left: 12rpx;
  100. }
  101. </style>