vite创建的vue3项目使用jsx

第一步:下载@vitejs/plugin-vue-jsx

npm install @vitejs/plugin-vue-jsx

第二步:在vite.config.js文件里面引入并添加插件


import vueJsx from '@vitejs/plugin-vue-jsx'


export default defineConfig(({ mode }) => {
  return {
    plugins: [
      vue(),
      vueJsx()
    ]
  }
})

第三步:在script标签上添加lang=‘jsx’就可以了

<script setup lang='jsx'></script>

猜你喜欢

转载自blog.csdn.net/q12as/article/details/132907928