diff --git a/examples/sites/env/.env.mobile b/examples/sites/env/.env.mobile index 2f6d46ab5..e0c5947d1 100644 --- a/examples/sites/env/.env.mobile +++ b/examples/sites/env/.env.mobile @@ -6,3 +6,4 @@ VITE_APP_MODE='mobile' VITE_APP_BUILD_BASE_URL='/' VITE_PLAYGROUND_URL=/playground.html +VITE_MOBILE_URL=/mobile.html diff --git a/examples/sites/env/.env.mobilealpha b/examples/sites/env/.env.mobilealpha index 05b68f947..e560dcc7f 100644 --- a/examples/sites/env/.env.mobilealpha +++ b/examples/sites/env/.env.mobilealpha @@ -5,4 +5,5 @@ VITE_BUILD_TARGET='inner' VITE_APP_MODE='mobile' VITE_APP_BUILD_BASE_URL=https://test-static-resource.obs.cn-north-7.ulanqab.huawei.com/tiny-vue-mobile-doc/${staticReleaseVersion}/ -VITE_PLAYGROUND_URL=/vue-playground \ No newline at end of file +VITE_PLAYGROUND_URL=/vue-playground +VITE_MOBILE_URL=/vue-mobile-preview \ No newline at end of file diff --git a/examples/sites/env/.env.mobileprod b/examples/sites/env/.env.mobileprod index fce678397..aa1e82245 100644 --- a/examples/sites/env/.env.mobileprod +++ b/examples/sites/env/.env.mobileprod @@ -5,4 +5,5 @@ VITE_BUILD_TARGET='inner' VITE_APP_MODE='mobile' VITE_APP_BUILD_BASE_URL=//res.hc-cdn.com/tiny-vue-mobile-doc/ -VITE_PLAYGROUND_URL=/vue-playground \ No newline at end of file +VITE_PLAYGROUND_URL=/vue-playground +VITE_MOBILE_URL=/vue-mobile-preview \ No newline at end of file diff --git a/examples/sites/mobile.html b/examples/sites/mobile.html new file mode 100644 index 000000000..91eb06a54 --- /dev/null +++ b/examples/sites/mobile.html @@ -0,0 +1,13 @@ + + + + + + + TinyVueMobile 演示 + + +
+ + + diff --git a/examples/sites/mobile/App.vue b/examples/sites/mobile/App.vue new file mode 100644 index 000000000..483c78628 --- /dev/null +++ b/examples/sites/mobile/App.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/examples/sites/mobile/main.ts b/examples/sites/mobile/main.ts new file mode 100644 index 000000000..43d27f624 --- /dev/null +++ b/examples/sites/mobile/main.ts @@ -0,0 +1,5 @@ +import { createApp } from 'vue' +import App from './App.vue' + +const app = createApp(App) +app.mount('#app') diff --git a/examples/sites/vite.config.ts b/examples/sites/vite.config.ts index 68db61ae8..8a5bad8a5 100644 --- a/examples/sites/vite.config.ts +++ b/examples/sites/vite.config.ts @@ -45,6 +45,7 @@ export default defineConfig((config) => { const isSaas = env.VITE_TINY_THEME === 'saas' const isPlus = env.VITE_APP_MODE === 'plus' const isInner = env.VITE_BUILD_TARGET === 'inner' + const isMobile = env.VITE_APP_MODE === 'mobile' const demosPath = isPlus ? '../plusdocs/pc' : `./demos/${env.VITE_APP_MODE}` const apisPath = isPlus ? '../plusdocs/apis' : './demos/apis' const menuPath = isSaas ? path.resolve('./demos/saas') : path.resolve(demosPath) @@ -64,6 +65,19 @@ export default defineConfig((config) => { dest: '@demos/mobile-first' }) } + + const buildInput = () => { + // design-server中一个路由对应一个页面 + const input = { + index: path.resolve(__dirname, './index.html'), + playground: path.resolve(__dirname, './playground.html') + } + if (isMobile) { + input.mobile = path.resolve(__dirname, './mobile.html') + } + return input + } + const viteConfig = { envDir: './env', base: env.VITE_APP_BUILD_BASE_URL || '/tiny-vue/', @@ -125,11 +139,7 @@ export default defineConfig((config) => { optimizeDeps: getOptimizeDeps(3), build: { rollupOptions: { - input: { - index: path.resolve(__dirname, './index.html'), - // design-server中添加一个专门路由指向 playground.html - playground: path.resolve(__dirname, './playground.html') - } + input: buildInput() } }, resolve: {