Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/americanContainer
| | |
| | | <template> |
| | | <div id="app"> |
| | | <<router-view /> |
| | | <router-view /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | return { |
| | | }; |
| | | }, |
| | | created() {}, |
| | | created() { }, |
| | | mounted() { |
| | | }, |
| | | methods: {}, |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <router-view /> |
| | | </div> |
| | | </template> |
New file |
| | |
| | | <template> |
| | | <div style="height: 100%;"> |
| | | <!-- 判断是否在空白页打开 --> |
| | | <template v-if="!isOneself"> |
| | | <div class="app-wrapper"> |
| | | </div> |
| | | </template> |
| | | <!-- 如果在空白页打开则不显示框架 --> |
| | | <template v-else> |
| | | <AppContent /> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import AppContent from './components/AppContent.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | | // 默认页面在框架内显示 |
| | | isOneself: false, |
| | | // 获取当前页面名称 |
| | | nowRouteName: '', |
| | | } |
| | | }, |
| | | components: { |
| | | AppContent, |
| | | }, |
| | | mounted() { |
| | | // 设置标题 |
| | | this.setNowRouteName(this.$route) |
| | | // 初始化加载一次判断是否在空白页打开 |
| | | this.isOneself = this.$route.meta.oneself |
| | | }, |
| | | methods: { |
| | | // 获取当前页面标题 |
| | | setNowRouteName(route) { |
| | | this.nowRouteName = route.meta.title |
| | | }, |
| | | }, |
| | | watch: { |
| | | // 监听route变化 |
| | | $route: function (newVal) { |
| | | this.setNowRouteName(newVal) |
| | | // 判断页面是否在空白页打开 |
| | | this.isOneself = newVal.meta.oneself |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped></style> |
| | |
| | | import Vue from 'vue' |
| | | import Router from 'vue-router' |
| | | import routers from './routers'; |
| | | import Vue from "vue"; |
| | | import VueRouter from "vue-router"; |
| | | import Layouts from "../layouts"; |
| | | |
| | | const changePush = Router.prototype.push; |
| | | Router.prototype.push = function push(location) { |
| | | return changePush.call(this, location).catch((err) => err); |
| | | }; |
| | | Vue.use(Router); |
| | | |
| | | |
| | | const createRouter = () => new Router({ |
| | | mode: 'hash', // require service support |
| | | scrollBehavior: () => ({ |
| | | y: 0 |
| | | }), |
| | | routes: routers |
| | | }) |
| | | |
| | | const router = createRouter() |
| | | export function resetRouter() { |
| | | const newRouter = createRouter() |
| | | router.matcher = newRouter.matcher // reset router |
| | | Vue.use(VueRouter); |
| | | const originalPush = VueRouter.prototype.push |
| | | VueRouter.prototype.push = function push(location) { |
| | | return originalPush.call(this, location).catch(err => err) |
| | | } |
| | | |
| | | export default router |
| | | /** |
| | | * path: "/login", ------页面地址 |
| | | component: () => import("../views/login"), ------组件地址 |
| | | meta: { |
| | | title: "登录", ------页面标题 |
| | | icon: "el-icon-user-solid", ------菜单图标 |
| | | oneself: true, ------是否在单独页面打开 |
| | | hide: true, ------是否隐藏改菜单 |
| | | } |
| | | */ |
| | | |
| | | const routes = [ |
| | | { |
| | | |
| | | path: "", |
| | | redirect: "login", |
| | | component: Layouts, |
| | | children: [ |
| | | { |
| | | path: "/login", |
| | | meta: { |
| | | title: "登录", |
| | | oneself: true, |
| | | hide: true, |
| | | privilege: 'login' |
| | | }, |
| | | component: () => import("../view/login"), |
| | | }, |
| | | ] |
| | | } |
| | | ]; |
| | | |
| | | const router = new VueRouter({ |
| | | mode: "history", |
| | | base: process.env.BASE_URL, |
| | | routes, |
| | | }); |
| | | |
| | | export default router; |
| | |
| | | <template> |
| | | <div class="content"> |
| | | 1 |
| | | </div> |
| | | </template> |
| | | |