Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue多页面入口配置 #9

Open
wan-wing opened this issue May 14, 2024 · 1 comment
Open

vue多页面入口配置 #9

wan-wing opened this issue May 14, 2024 · 1 comment

Comments

@wan-wing
Copy link
Owner

wan-wing commented May 14, 2024

https://blog.csdn.net/snowball_li/article/details/132154902?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-132154902-blog-123864755.235^v43^pc_blog_bottom_relevance_base1&spm=1001.2101.3001.4242.2&utm_relevant_index=4

https://blog.csdn.net/weixin_63513903/article/details/124571449

build: {
      outDir: 'dist', // 指定输出目录为 dist
      assetsDir: 'static', // 指定静态资源目录为 static
      rollupOptions: {
        input: {
          about: path.resolve(__dirname, 'about.html'), // 另一个入口文件  

          index: path.resolve(__dirname, 'index.html'), // 主入口文件
        }
      }
    }

index.html

  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.js"></script>
  </body>

about.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>about AntPesa</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/about.js"></script>
  </body>
</html>

main.js

import App from './App.vue'
import router from './router/mainRouter.js';
const app = createApp(App);
  // 使用路由11
app.use(router);
// app.mount('#app');
console.log('import.meta.env.VITE_BASE_URL', import.meta.env.VITE_BASE_URL);
app.mount('#app')
```;

about.js
同上
@wan-wing
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant