vue3 全局组件注册

一,创建组件

html 复制代码
<template>
    <h3></h3>
</template>

<script>

</script>

<style>
h3{
    border: 18px solid red;
}
</style>

二,注册组件

javascript 复制代码
import hello from './components/hello.vue'
const app = createApp(App)
    app.component("hello",hello)
app.mount('#app')

三,显示组件

javascript 复制代码
 <template>
    <!-- 显示组件 -->
    <hello />
</template>

<script >

</script>
相关推荐
GISer_Jing9 分钟前
浏览器 Agent 插件开发规格书 (SPEC)
前端·ai·前端框架·edge浏览器
别叫我->学废了->lol在线等22 分钟前
评估总结模块(暂不做)
前端
清灵xmf28 分钟前
CC Switch:解决 AI 编程工具配置
前端·人工智能·cc switch
IT_陈寒40 分钟前
Redis缓存击穿把我坑惨了,原来这样解决才靠谱
前端·人工智能·后端
mfxcyh1 小时前
Vue3 右键菜单实现方案(基于 vue3-context-menu)
前端
treesforest1 小时前
从IP地址归属地查询到IP地理位置精准查询指南
服务器·前端·网络
棉猴1 小时前
python海龟绘图之画布与窗口
javascript·python·html·setup·turtle·海龟绘图·screensize
LF男男1 小时前
WindmillBullect.cs
前端
小白学大数据1 小时前
Python 爬虫爬取应用商店数据:请求构造与数据解析
前端·爬虫·python·数据分析
pkowner1 小时前
若依分页问题及解决方法
java·前端·算法