index.vue 667 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <div>
  3. <van-empty :image="imageSrc" :description="description" v-if="imageSrc" />
  4. <van-empty :description="description" v-else />
  5. </div>
  6. </template>
  7. <script>
  8. import { mapGetters } from 'vuex'
  9. export default {
  10. name: 'simple-empty',
  11. props: {
  12. image: {
  13. type: String,
  14. default: '',
  15. },
  16. name: {
  17. type: String,
  18. default: '',
  19. },
  20. description: {
  21. type: String,
  22. default: '描述文字',
  23. },
  24. },
  25. computed: {
  26. ...mapGetters(['static']),
  27. imageSrc() {
  28. if (this.image) return this.image
  29. if (this.name) return this.static + '/' + this.name
  30. return ''
  31. },
  32. },
  33. }
  34. </script>