1、main.js程式碼如下:
// import './assets/main.css'
import {createApp} from 'vue'
import App from './App.vue'
import Config from "@/config.js";
import Testpage001 from "@/view/Testpage001.vue";
const app = createApp(App);
// 定義一個全域性元件,名字為Global1
app.component('Global1', Testpage001);
app.provide('Config', Config)
app.mount('#app')
2、App.vue程式碼如下:
<template> <Global1/> </template> <script> </script>
3、效果如下:
4、瀏覽器顯示