Vite 中文文档 Vite 中文文档
指南
GitHub (opens new window)
指南
GitHub (opens new window)
  • vite

    • 指引
    • 为什么选 Vite
    • 开始
    • 功能
    • 命令行界面
    • 使用插件
    • 依赖预构建
    • 静态资源处理
    • 构建生产版本
    • 部署静态站点
    • 环境变量和模式
    • 服务端渲染
    • 后端集成
    • 与其他工具比较
    • 故障排除
    • 从 v3 迁移
  • API

  • 配置参考

  • vite

  • API

  • 配置参考

vite-plugin-vue-setup-name-support


Make the vue script setup syntax support the name attribute

Install (yarn or npm)


node version:>=12.0.0

vite version:>=2.0.0

  1. ``` shell
  2. yarn add vite-plugin-vue-setup-extend -D
  3. ```

or

  1. ``` shell
  2. npm i vite-plugin-vue-setup-extend -D
  3. ```

Usage


Config plugin in vite.config.ts. In this way, the required functions can be introduced as needed

  1. ``` ts
  2. import { defineConfig, Plugin } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueSetupExtend from 'vite-plugin-vue-setup-extend'

  5. export default defineConfig({
  6.   plugins: [vue(), vueSetupExtend()],
  7. })
  8. ```

SFC

  1. ``` html
  2. <template>
  3.   <div>hello world {{ a }}</div>
  4. </template>
  5. <script lang="ts" setup name="App">
  6.   const a = 1
  7. </script>
  8. ```

Sample project


Vben Admin

License


MIT
Last Updated: 2023-05-23 11:11:51