Commit d0c30963 by 胡悦

提交

1 parent b49bcbe5
{
"root": true,
"env": {
"node": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
},
"parserOptions": {
"parser": "babel-eslint"
}
}
module.exports = {
root: true,
env: {
node: true
},
extends: ['plugin:vue/essential', '@vue/prettier'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
}
}
{
"name": "blog",
"name": "settings",
"version": "0.1.0",
"private": true,
"scripts": {
......
......@@ -8,19 +8,27 @@ VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
function getRoutes({ name, id, routesData }) {
const routes = []
if (routesData && name && id) {
for (let i = 0, length = routesData.length; i < length; i += 1) {
const element = routesData[i]
if (element && element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) {
const path = element.path.slice(name.length + 1)
element.path = path
element.component = () => import('@/views' + path + '.vue')
routes.push(element)
}
}
}
return routes
// function getRoutes({ name, id, routesData }) {
// const routes = []
// if (routesData && name && id) {
// for (let i = 0, length = routesData.length; i < length; i += 1) {
// const element = routesData[i]
// if (element && element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) {
// const path = element.path.slice(name.length + 1)
// element.path = path
// element.component = () => import('@/views' + path + '.vue')
// routes.push(element)
// }
// }
// }
// return routes
// }
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.path + '.vue') })
return routes
}, [])
}
export { VueRouter, routes, getRoutes }
......@@ -18,7 +18,7 @@ const staticRoutes = Object.freeze([{
},
{
name: 'BaseInfo',
path: '/baseInfo',
path: '/baseInfo/index',
component: resolve => require([`@/views/baseInfo/index.vue`], resolve),
meta: {}
},
......@@ -30,26 +30,26 @@ const staticRoutes = Object.freeze([{
},
{
name: 'Account',
path: '/account',
path: '/account/index',
component: resolve => require([`@/views/account/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/merchant/index.html'
url: 'http://192.168.1.68:5501/html/merchant/index.html'
}
},
{
name: 'Employee',
path: '/employee',
path: '/employee/index',
component: resolve => require([`@/views/employee/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/employee/index.html'
url: 'http://192.168.1.68:5501/html/employee/index.html'
}
},
{
name: 'Role',
path: '/role',
path: '/role/index',
component: resolve => require([`@/views/role/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/role/index.html'
url: 'http://192.168.1.68:5501/html/role/index.html'
}
},
])
......
......@@ -23,7 +23,8 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes({ name, id, routesData })
// routes = getRoutes({ name, id, routesData })
routes = getRoutes(routesData)
subscribe({ messenger })
}
export async function mount(props) {
......
<template>
<div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal>
<GLExternal v-if="url" :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
const params = {
merchantAccountLevel: 1,
merchantId: 81,
model: 2
}
export default {
name: 'adapter',
name: 'account',
data() {
return {
url: this.$router.currentRoute.meta.url
// url: `${this.$router.currentRoute.meta.url}?merchantAccountLevel=${merchantAccountLevel}&merchantId=${merchantId}`
url: ''
}
},
mounted() {
console.log(this.$common)
this.url = this.$router.currentRoute.meta.url + '?' + this.$common.utils.genUrlParams(params)
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
console.log(params, '-----------------------')
this.$history.push(params.path)
})
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!