subject-model.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Button, Checkbox, Icon, Image } from "vant";
  2. import { defineComponent } from "vue";
  3. import styles from './subject-model.module.less';
  4. import checkBoxActive from '../images/checkbox_active.png';
  5. import checkBoxDefault from '../images/checkbox_default.png';
  6. export default defineComponent({
  7. name: "subject-model",
  8. props: {
  9. onChoice: {
  10. type: Function,
  11. default: (item: any) => { }
  12. }
  13. },
  14. data() {
  15. return {
  16. checkBox: []
  17. }
  18. },
  19. render() {
  20. return (
  21. <div class={styles.subjects}>
  22. <div class={styles['subject-list']}>
  23. {[1, 2, 3, 4, 5].map((item: any) => (
  24. <div class={styles['subject-item']}>
  25. <Image src="https://daya.ks3-cn-beijing.ksyun.com/202110/Sn76BUQ.png" width="100%" height="100%" fit="cover" />
  26. <div class={styles.topBg}>
  27. <Checkbox v-model={this.checkBox} name={1} class={styles.checkbox} v-slots={{
  28. icon: (props: any) => (
  29. <Icon name={props.checked ? checkBoxActive : checkBoxDefault} size="22" />
  30. )
  31. }} />
  32. <p class={styles.name}>长笛</p>
  33. </div>
  34. </div>
  35. )) }
  36. </div>
  37. <div class={styles["btn-group"]}>
  38. <Button round block type="primary" onClick={() => this.onChoice(true)}>确定</Button>
  39. </div>
  40. </div>
  41. )
  42. }
  43. })