tool.tsx 923 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Grid, GridItem } from 'vant'
  2. import { defineComponent } from 'vue'
  3. import styles from './tool.module.less'
  4. import iconPen from '../image/icon-pen.png'
  5. export type ToolType = 'init' | 'pen'
  6. export type ToolItem = {
  7. type: ToolType
  8. name: string
  9. icon: string
  10. }
  11. export default defineComponent({
  12. name: 'tool',
  13. emits: ['handleTool'],
  14. setup(props, { emit }) {
  15. const tool: ToolItem[] = [
  16. {
  17. type: 'pen',
  18. icon: iconPen,
  19. name: '批注'
  20. }
  21. ]
  22. return () => (
  23. <div class={styles.tool}>
  24. <div class={styles.title}>教学功能</div>
  25. <Grid class={styles.grid} columnNum={3} border={false}>
  26. {tool.map((item) => (
  27. <GridItem
  28. icon={item.icon}
  29. text={item.name}
  30. onClick={() => emit('handleTool', item)}
  31. ></GridItem>
  32. ))}
  33. </Grid>
  34. </div>
  35. )
  36. }
  37. })