index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="u-panel" :class="{'child-panel': second}">
  3. <view class="u-panel-head">
  4. <view class="u-panel-title" v-if="title">
  5. {{ title }}
  6. <view class="u-panel-m-title" v-if="mTitle">
  7. {{mTitle}}
  8. </view>
  9. </view>
  10. <view v-if="link" class="u-panel-link" @tap="onClickLink">
  11. {{ linkText || '查看更多' }}
  12. <van-icon class="van-icon" name="arrow"/>
  13. </view>
  14. </view>
  15. <view class="u-panel-body">
  16. <slot></slot>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'UPanel',
  23. options: {
  24. styleIsolation: 'shared'
  25. },
  26. props: {
  27. title: String,
  28. mTitle: String,
  29. link: String,
  30. linkText: String,
  31. second: Boolean,
  32. },
  33. computed: {
  34. style() {
  35. }
  36. },
  37. watch: {},
  38. data() {
  39. return {}
  40. },
  41. created() {
  42. },
  43. mounted() {
  44. },
  45. methods: {
  46. onClickLink() {
  47. this.navigateTo(this.link)
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. .u-panel {
  54. padding: 28rpx 28rpx;
  55. &.child-panel {
  56. padding: 0;
  57. .u-panel-title{
  58. /* &:after{
  59. display: none;
  60. }*/
  61. }
  62. }
  63. }
  64. .u-panel-head {
  65. @include display-flex-between;
  66. margin-bottom: 26rpx;
  67. .u-panel-title {
  68. position: relative;
  69. padding-bottom: 20rpx;
  70. font-size: $fontSize4;
  71. line-height: $fontSize5;
  72. font-weight: 500;
  73. color: #000000;
  74. .u-panel-m-title {
  75. display: inline-block;
  76. font-size: $fontSize1;
  77. color: #7D7D7D;
  78. margin-left: 10rpx;
  79. }
  80. &:after {
  81. @include after;
  82. left: 12rpx;
  83. bottom: 0;
  84. width: 34rpx;
  85. height: 0;
  86. border: 3rpx solid $buttonPrimaryColor;
  87. border-radius: 2rpx;
  88. margin: auto;
  89. }
  90. }
  91. .u-panel-link {
  92. font-size: $fontSize1;
  93. color: #7D7D7D;
  94. cursor: pointer;
  95. padding-bottom: 20rpx;
  96. }
  97. }
  98. </style>