-
使用pug
安装依赖
yarn add pug pug-plain-loader<template lang="pug"> hello-rowld() </template>这里要注意hello-world之前不允许有空格,否则会提示
unexpected token "indent"错误 -
props和emits,官方说明已经很详细了
单文件组件 <script setup> 定义props和emits
单文件组件 <script setup> ts环境下定义props和emit
-
错误记录
interface Props { ready:(scene:any)=>any } const props = withDefaults(defineProps<Props>(), { //会报错,提示scene未定义 ready(scene){ ... scene.add(cube) }, //正确使用方式 ready:(scene)=>{ ... scene.add(cube) } })
-
-
使用vite加载commondjs失败模块的处理