diff --git a/apps/shell-vue-app/src/App.vue b/apps/shell-vue-app/src/App.vue index eab0bc8..f29a852 100644 --- a/apps/shell-vue-app/src/App.vue +++ b/apps/shell-vue-app/src/App.vue @@ -5,17 +5,16 @@ const apps = reactive([ { name: 'vue3', url: '//localhost:8001/', - visible: true + visible: true, }, { name: 'vue2', url: '//localhost:8002/', - visible: false - } + visible: false, + }, ]) function createContext() { - const windowMap = new Map() return { @@ -29,19 +28,44 @@ function showApp(index: number) { }) } +function beforeLoad() { + +} + +function beforeMount(win: Window) { + console.log(win) +} + +function afterMount(win: Window) { + console.log(win) +} + +function beforeUnmount() { + +} + +function afterUnmount() { + +} diff --git a/apps/vue-app/package.json b/apps/vue-app/package.json index 99b81d0..c9b9a96 100644 --- a/apps/vue-app/package.json +++ b/apps/vue-app/package.json @@ -9,10 +9,14 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.4.29" + "vue": "^3.4.29", + "vue-router": "^4.4.0" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.5", + "autoprefixer": "^10.4.19", + "postcss": "^8.4.39", + "tailwindcss": "^3.4.4", "typescript": "^5.2.2", "vite": "^5.3.1", "vue-tsc": "^2.0.26" diff --git a/apps/vue-app/postcss.config.js b/apps/vue-app/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/apps/vue-app/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/apps/vue-app/src/App.vue b/apps/vue-app/src/App.vue index bb666a8..fbff083 100644 --- a/apps/vue-app/src/App.vue +++ b/apps/vue-app/src/App.vue @@ -1,30 +1,26 @@ - + diff --git a/apps/vue-app/src/assets/vue.svg b/apps/vue-app/src/assets/vue.svg deleted file mode 100644 index 770e9d3..0000000 --- a/apps/vue-app/src/assets/vue.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/vue-app/src/components/HelloWorld.vue b/apps/vue-app/src/components/HelloWorld.vue deleted file mode 100644 index b58e52b..0000000 --- a/apps/vue-app/src/components/HelloWorld.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/apps/vue-app/src/main.ts b/apps/vue-app/src/main.ts index 2425c0f..90b8a8d 100644 --- a/apps/vue-app/src/main.ts +++ b/apps/vue-app/src/main.ts @@ -1,5 +1,21 @@ +import { createRouter, createWebHistory } from 'vue-router' import { createApp } from 'vue' import './style.css' import App from './App.vue' +import { routes } from './router' -createApp(App).mount('#app') +if (window.__POWERED_BY_WUJIE__) { + let instance: App + window.__WUJIE_MOUNT = () => { + const router = createRouter({ history: createWebHistory(), routes }) + instance = createApp(App) + instance.use(router) + instance.mount('#app') + } + window.__WUJIE_UNMOUNT = () => { + instance.unmount() + } +} +else { + createApp(App).use(createRouter({ history: createWebHistory(), routes })).mount('#app') +} diff --git a/apps/vue-app/src/pages/bar.vue b/apps/vue-app/src/pages/bar.vue new file mode 100644 index 0000000..2754825 --- /dev/null +++ b/apps/vue-app/src/pages/bar.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/apps/vue-app/src/pages/foo.vue b/apps/vue-app/src/pages/foo.vue new file mode 100644 index 0000000..1ace98f --- /dev/null +++ b/apps/vue-app/src/pages/foo.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/apps/vue-app/src/pages/index.vue b/apps/vue-app/src/pages/index.vue new file mode 100644 index 0000000..5105537 --- /dev/null +++ b/apps/vue-app/src/pages/index.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/apps/vue-app/src/router.ts b/apps/vue-app/src/router.ts new file mode 100644 index 0000000..6a2ca69 --- /dev/null +++ b/apps/vue-app/src/router.ts @@ -0,0 +1,9 @@ +import Index from './pages/index.vue' +import Bar from './pages/bar.vue' +import Foo from './pages/foo.vue' + +export const routes = [ + { path: '/', component: Index }, + { path: '/foo', component: Foo }, + { path: '/Bar', component: Bar }, +] diff --git a/apps/vue-app/src/style.css b/apps/vue-app/src/style.css index bb131d6..ab8d279 100644 --- a/apps/vue-app/src/style.css +++ b/apps/vue-app/src/style.css @@ -1,79 +1,11 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} +@tailwind base; +@tailwind components; +@tailwind utilities; a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} + @apply block text-slate-400 border-current font-semibold underline; -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -.card { - padding: 2em; -} - -#app { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; + &.router-link-active { + @apply text-sky-500; } } diff --git a/apps/vue-app/tailwind.config.js b/apps/vue-app/tailwind.config.js new file mode 100644 index 0000000..146cfe5 --- /dev/null +++ b/apps/vue-app/tailwind.config.js @@ -0,0 +1,11 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: [ + './index.html', + './src/**/*.{vue,js,ts,jsx,tsx}', + ], + theme: { + extend: {}, + }, + plugins: [], +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bdcda87..1802a6a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -117,10 +117,22 @@ importers: vue: specifier: ^3.4.29 version: 3.4.31(typescript@5.5.3) + vue-router: + specifier: ^4.4.0 + version: 4.4.0(vue@3.4.31(typescript@5.5.3)) devDependencies: '@vitejs/plugin-vue': specifier: ^5.0.5 version: 5.0.5(vite@5.3.3(@types/node@20.14.10)(sass@1.77.8))(vue@3.4.31(typescript@5.5.3)) + autoprefixer: + specifier: ^10.4.19 + version: 10.4.19(postcss@8.4.39) + postcss: + specifier: ^8.4.39 + version: 8.4.39 + tailwindcss: + specifier: ^3.4.4 + version: 3.4.4(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)) typescript: specifier: ^5.2.2 version: 5.5.3 @@ -4733,6 +4745,11 @@ packages: peerDependencies: vue: ^2 + vue-router@4.4.0: + resolution: {integrity: sha512-HB+t2p611aIZraV2aPSRNXf0Z/oLZFrlygJm+sZbdJaW6lcFqEDQwnzUBXn+DApw+/QzDU/I9TeWx9izEjTmsA==} + peerDependencies: + vue: ^3.2.0 + vue-template-compiler@2.7.16: resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} @@ -10121,6 +10138,11 @@ snapshots: dependencies: vue: 2.7.16 + vue-router@4.4.0(vue@3.4.31(typescript@5.5.3)): + dependencies: + '@vue/devtools-api': 6.6.3 + vue: 3.4.31(typescript@5.5.3) + vue-template-compiler@2.7.16: dependencies: de-indent: 1.0.2