index.js 490 B

1234567891011121314151617181920
  1. import { VantComponent } from '../common/component';
  2. const PRESETS = ['error', 'search', 'default', 'network'];
  3. VantComponent({
  4. props: {
  5. description: String,
  6. image: {
  7. type: String,
  8. value: 'default',
  9. },
  10. },
  11. created() {
  12. if (PRESETS.indexOf(this.data.image) !== -1) {
  13. this.setData({
  14. imageUrl: `https://img.yzcdn.cn/vant/empty-image-${this.data.image}.png`,
  15. });
  16. } else {
  17. this.setData({ imageUrl: this.data.image });
  18. }
  19. },
  20. });