completed test for plugin routes

This commit is contained in:
2020-04-11 16:47:51 +02:00
parent 9195c4feae
commit 2838eeadab
5 changed files with 32 additions and 13 deletions
-3
View File
@@ -21,9 +21,6 @@
import AuthApi from 'zeroservices/auth.js'
import 'zero/axios.config.js'
console.info(Router);
console.dir(Router.options.routes);
export default {
name: 'app',
@@ -0,0 +1,13 @@
<template>
<div class="my-plugin" style="padding:30px;">
settings for <b>my-plugin</b>
</div>
</template>
<script>
export default {
}
</script>
+10 -3
View File
@@ -1,13 +1,20 @@
<template>
<div class="my-plugin">
hi from <code>my-plugin</code>
<div class="my-plugin" style="padding: 30px;">
hi from <b>my-plugin</b>
<br><br>
<ui-button type="white" label="Settings" @click="goToSettings" icon="fth-settings" />
</div>
</template>
<script>
export default {
methods: {
goToSettings()
{
this.$router.push({ name: 'MyPluginSettings' });
}
}
}
</script>
+3 -1
View File
@@ -1,6 +1,8 @@
import View from './myplugin';
import ViewSettings from './myplugin-settings';
export default [
{ path: '/myplugin', component: View }
{ path: '/myplugin', component: View, name: 'MyPlugin' },
{ path: '/myplugin/settings', component: ViewSettings, name: 'MyPluginSettings' }
];
+6 -6
View File
@@ -5,23 +5,23 @@ import ViewSettings from 'zeropages/settings';
import ViewSettingsUser from 'zeropages/settings/user';
import ViewDefault from 'zeropages/page';
import ViewLists from 'zeropages/lists';
import MyPluginRoutes from './Plugins/MyPlugin/Routes'
//import MyPluginRoutes from './Plugins/MyPlugin/Routes';
Vue.use(VueRouter);
history.scrollRestoration = 'manual';
const routes = [
let routes = [
{ path: '/settings/user', component: ViewSettingsUser },
{ path: '/settings*', component: ViewSettings },
{ path: '/lists', component: ViewLists },
{ path: '*', component: ViewDefault }
];
MyPluginRoutes.forEach(route =>
{
routes.push(route);
});
//MyPluginRoutes.forEach(route =>
//{
// routes.push(route);
//});
const router = new VueRouter({
mode: 'history',