w4ng3 / web-course-docs

front-end docs
https://doc.riddler.wiki/
0 stars 1 forks source link

项目启动白屏 #3

Closed master748 closed 2 months ago

master748 commented 2 months ago

问题:在文档老表,睁眼看世界啦中[编写一个 i18n 插件(vue)]将 script 部分写成一个组合函数,实现逻辑复用 实在项目情况是启动完白屏 项目: https://github.com/master748/webmonorepo-main

w4ng3 commented 2 months ago

在你的main.ts文件下:

import { createApp } from 'vue'
import App from './App.vue'

import i18nPlugin from "./plugins/i18n"
const app = createApp(App);
app.use(i18nPlugin);

import './style.css'
// main.ts
import 'virtual:uno.css'
// <div> {{ p.name + ':' + p.slogan }}</div>
createApp(App).mount('#app')

出现了两次 createApp(App) ,重复了,导致安装i8n插件的实例1没有正确挂载到app上,应该改成

const app = createApp(App)
app.use(i18nPlugin)
app.mount('#app')
w4ng3 commented 2 months ago

所有import都要放在顶部,不要在后面写代码

master748 commented 2 months ago

已整改!