index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="u-panel">
  3. <view class="u-panel-head display-flex-between">
  4. <view class="u-panel-title">{{ title }}</view>
  5. <view v-if="link" class="u-panel-link" @tap="onClickLink">
  6. {{ linkText || '查看更多' }} <van-icon class="van-icon" name="arrow" />
  7. </view>
  8. </view>
  9. <view class="u-panel-body">
  10. <slot></slot>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. options: {
  17. styleIsolation: 'shared'
  18. },
  19. props: {
  20. title: String,
  21. link: String,
  22. linkText: String
  23. },
  24. computed: {
  25. style() {
  26. }
  27. },
  28. watch: {
  29. },
  30. data() {
  31. return {
  32. }
  33. },
  34. created() {
  35. },
  36. mounted() {
  37. },
  38. methods: {
  39. onClickLink() {
  40. if (this.link.indexOf('http') === -1) {
  41. uni.navigateTo({
  42. url: this.link
  43. })
  44. }
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .u-panel{
  51. padding: 24rpx 28rpx;
  52. }
  53. .u-panel-head{
  54. margin-bottom: 26rpx;
  55. .u-panel-title{
  56. position: relative;
  57. padding-bottom: 20rpx;
  58. font-size: $fontSize4;
  59. font-weight: 500;
  60. color: #000000;
  61. &:after{
  62. @extend .after;
  63. left: 0;
  64. right: 0;
  65. bottom: 0;
  66. width: 34rpx;
  67. height: 0;
  68. border: 4rpx solid $buttonPrimaryColor;
  69. margin: auto;
  70. }
  71. }
  72. .u-panel-link{
  73. font-size: $fontSize1;
  74. color: #7D7D7D;
  75. }
  76. }
  77. </style>