tool.tsx 938 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { Grid, GridItem } from "vant"
  2. import { defineComponent } from "vue"
  3. import styles from "./tool.module.scss"
  4. import iconPen from "../image/icon-pen.png"
  5. export type ToolType = "init" | "pen" | "white"
  6. export type ToolItem = {
  7. type: ToolType
  8. name: string
  9. icon: string
  10. }
  11. export default defineComponent({
  12. name: "o-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 icon={item.icon} text={item.name} onClick={() => emit("handleTool", item)}></GridItem>
  28. ))}
  29. </Grid>
  30. </div>
  31. )
  32. }
  33. })