跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • vue-cli4.5.11 实现多入口路由功能实现
未分類
5 2 月 2021

vue-cli4.5.11 实现多入口路由功能实现

vue-cli4.5.11 实现多入口路由功能实现

資深大佬 : phpxiaowangzi 3

vue.config.js:

module.exports = {     pages:{         supplier:{             entry:'src/supplier/main.js',             template:'public/supplier.html',             filename:'supplier.html',             title:'合作伙伴'         },         staff:{             entry:'src/staff/main.js',             template:'public/staff.html',             filename:'staff.html',             title:'员工助手'         }     } } 

main.js:

import { createApp } from 'vue' import VueRouter from 'vue-router' import Supplier from './Supplier.vue'  import MicroPay from './components/MicroPay/index.vue'  const routes = [     {path:'/MicroPay', component:MicroPay} ]  const router = new VueRouter({  mode:'hash',  routes })  createApp(Supplier).use(router).mount('#supplier') 

Supplier.vue:

<template>     <div id="supplier">         <router-view></router-view>     </div> </template>  <script>     export default {         name: 'Supplier'     } </script> 

components/MicroPay/index.vue:

<template>     <div>MicroPay</div> </template>  <script>     export default {         name:'MicroPay'     } </script> 

现在访问 http://localhost:8080/supplier#/MicroPay 空白无法显示 components/MicroPay/index.vue 文件内容,求教是否路由设置不正确,求前端大神指教。

大佬有話說 (1)

  • 資深大佬 : PinkRabbit

    空白的时候,看下控制台有没有报什么错误呢

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具