0 Star 0 Fork 0

ctrlc-git / vite-setup-extend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

@ctrlc/vite-plugin-vue-setup-extend

用于vue3<script setup>语法时,扩展name以及inheritAttrs属性, 用于显式声明组件展示时的名称、用于控制是否启用默认的组件attribute透传行为

使用手册

安装

npm i @ctrlc/vite-plugin-vue-setup-extend -D

语法

vueScriptExtend(Options)

配置项

参数 类型 默认值 说明
Options.include FilterPattern undefined rollup过滤模式
Options.exclude FilterPattern undefined rollup过滤模式
Options.hasMap boolean true 是否启用 magic-string map方法 优化控制台日志
Options.hires boolean true magic-string 配置参数

示例

vite.config.ts文件中引入插件:

...
import vue from '@vitejs/plugin-vue'
import vueScriptExtend from '@ctrlc/vite-plugin-vue-setup-extend';

export default defineConfig({
  plugins: [vue(), vueScriptExtend()],
})
<template>
  <div>hello world</div>
</template>
<!-- 扩展 setup模式 script属性 -->
<script lang="ts" setup name="App" inherit-attrs="false">
  // code here
</script>

编译后转义为

import { defineComponent } from 'vue'

export default defineComponent({
  name: "App",
  inheritAttrs: false,
})

文档

MIT License Copyright (c) 2023 提莫打野迷了路 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用于vue3在<script setup>语法时,扩展name以及inheritAttrs属性 展开 收起
TypeScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/ctrlc-git/ctrlc-vite-setup-extend.git
git@gitee.com:ctrlc-git/ctrlc-vite-setup-extend.git
ctrlc-git
ctrlc-vite-setup-extend
vite-setup-extend
master

搜索帮助