Price.vue 822 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div class="price-container">
  3. <van-icon name="diy-iconLogoLight" v-if="!alreadyBuy" />
  4. <span class="p-r" :class="{bought: alreadyBuy}">{{ price }}</span>
  5. </div>
  6. </template>
  7. <script lang="ts">
  8. import { Component, Vue, Prop } from 'vue-property-decorator'
  9. import { Icon } from 'vant'
  10. @Component({
  11. name: 'docs-price',
  12. components: {
  13. [Icon.name]: Icon
  14. }
  15. })
  16. export default class Price extends Vue {
  17. @Prop({ default: '' }) price?: string | undefined;
  18. get alreadyBuy () {
  19. return this.price === '已购买'
  20. }
  21. }
  22. </script>
  23. <style lang="scss" scoped>
  24. .price-container {
  25. display: flex;
  26. align-items: center;
  27. @include diy-icon('iconLogoLight', 20, 20);
  28. .p-r {
  29. margin-left: 4px;
  30. font-size: 14px;
  31. color: #ff3a20;
  32. &.bought {
  33. color: #686868;
  34. }
  35. }
  36. }
  37. </style>