card.vue 470 B

12345678910111213141516171819202122232425
  1. <template>
  2. <view
  3. :class="['card', props.class]"
  4. :style="{ width: width ? width + 'rpx' : '100%' }"
  5. >
  6. <slot></slot>
  7. </view>
  8. </template>
  9. <script setup>
  10. import { ref } from 'vue';
  11. const props = defineProps(['class', 'width'])
  12. const className = ref(props.class)
  13. const width = ref(props.width)
  14. </script>
  15. <style lang="less">
  16. .card {
  17. width: 100%;
  18. background-color: #fff;
  19. border-radius: 7.5rpx;
  20. box-sizing: border-box;
  21. overflow: hidden;
  22. }
  23. </style>