sh-title-card.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="sh-title-card u-m-b-10">
  3. <view class="title-box">
  4. <image class="title-bg" :src="bgImage" mode="aspectFill"></image>
  5. <view class="title-text" :style="{ color: titleColor }">{{ title }}</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. /**
  11. * shTitleCard 组件标题栏
  12. * @property {String} bgImage - 背景图
  13. * @property {String} title - 标题
  14. * @property {String} titleColor - 标题颜色
  15. */
  16. export default {
  17. components: {},
  18. data() {
  19. return {};
  20. },
  21. computed: {},
  22. props: {
  23. bgImage: {
  24. type: String,
  25. default: ''
  26. },
  27. title: {
  28. type: String,
  29. default: ''
  30. },
  31. titleColor: {
  32. type: String,
  33. default: ''
  34. }
  35. },
  36. methods: {}
  37. };
  38. </script>
  39. <style lang="scss">
  40. .sh-title-card {
  41. width: 750rpx;
  42. }
  43. .title-box {
  44. width: 710rpx;
  45. height: 88rpx;
  46. margin: 0 auto;
  47. position: relative;
  48. border-radius: 30rpx;
  49. .title-bg {
  50. width: 100%;
  51. height: 100%;
  52. }
  53. .title-text {
  54. position: absolute;
  55. top: 50%;
  56. left: 50%;
  57. transform: translate(-50%, -50%);
  58. font-weight: bold;
  59. }
  60. }
  61. </style>