index.tsx 543 B

12345678910111213141516171819202122232425
  1. import { Image } from "vant";
  2. import { defineComponent } from "vue";
  3. import TheLoading from "../TheLoading";
  4. import styles from './index.module.less'
  5. export default defineComponent({
  6. name: "TheImage",
  7. props: ["src"],
  8. setup(props) {
  9. const imageSlots = {
  10. loading: () => <TheLoading />,
  11. error: () => <TheLoading />,
  12. };
  13. return () => (
  14. <Image
  15. class={styles.image}
  16. width="100%"
  17. height="100%"
  18. lazy-load
  19. src={props.src}
  20. v-slots={imageSlots}
  21. />
  22. );
  23. },
  24. });