惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

liaooo

react-router在组件外操作路由 – liaooo Vue3自动导入常用api – liaooo Vue+ts使用animate.css – liaooo uni-app中flyio的使用 – liaooo 【开源】查看网站在不同设备的预览效果 – liaooo Pinia的使用 – liaooo craco配置postcss不生效 – liaooo Vite配置preprocessorOptions全局引入less – liaooo 监听Pinia仓库中的数据变化 – liaooo
Vue3自定义组件名字 – liaooo
liao · 2023-07-09 · via liaooo

在使用setup语法糖的时候没办法直接定义组件的名字,有两种解决方法

写两个script标签

<script lang="ts">
import { defineComponent, onMounted } from 'vue'
//script1:用来定义name
export default defineComponent({
  name: '自定义name'
})
</script>

<script lang="ts" setup>
 //script2:用来定义setup语法糖
</script>

使用vite-plugin-vue-setup-extend

安装
npm i vite-plugin-vue-setup-extend -D
配置vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 引入vite-plugin-vue-setup-extend
import VueSetupExtend from 'vite-plugin-vue-setup-extend'

export default defineConfig({
  // 配置
    plugins: [vue(), VueSetupExtend()],
})
使用
<script lang="ts" setup name="自定义name">
// 使用vite-plugin-vue-setup-extend插件
</script>

https://blog.csdn.net/SunFlower914/article/details/126579209