app-math-card.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="app-math-card" @click="handleClick">
  3. <view class="cover-image">
  4. <u-image width="100%" height="200rpx" :src="coverImage"></u-image>
  5. </view>
  6. <view class="title">{{title}}</view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name: "app-math-card",
  12. props:{
  13. coverImage: {
  14. type: String,
  15. required: true
  16. },
  17. index: {
  18. type: Number,
  19. },
  20. title: {
  21. type: String,
  22. required: true
  23. },
  24. customStyle:{
  25. type: Object,
  26. default() {
  27. return {};
  28. }
  29. }
  30. },
  31. data() {
  32. return {}
  33. },
  34. methods: {
  35. handleClick(){
  36. this.$emit('open',this.index);
  37. }
  38. },
  39. computed:{
  40. getStyle() {
  41. return Object.assign(this.customStyle);
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .app-math-card{
  48. width: 345rpx;
  49. border-radius: 16rpx;
  50. overflow: hidden;
  51. margin-bottom: 24rpx;
  52. box-shadow: 0 4rpx 4rpx rgba(6, 149, 137, 0.15);
  53. background: #ffffff;
  54. margin-left: 10px;
  55. float: left;
  56. .cover-image{
  57. padding: 0 10rpx;
  58. }
  59. >.title{
  60. padding: 16rpx 0;
  61. text-align: center;
  62. background: $main-color;
  63. color: #ffffff;
  64. }
  65. }
  66. </style>