make HMR work again + favicon + get route meta from parent if child has none

This commit is contained in:
2020-10-29 11:10:58 +01:00
parent d329e673c0
commit a03b9f327b
7 changed files with 44 additions and 20 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ namespace zero.Core.Api
if (app == null)
{
Logger.LogWarning($"Could not resolve application for host $host", context.Request.Host);
Logger.LogWarning("Could not resolve application for host {host}", context.Request.Host);
IList<IApplication> apps = await GetApplications();
app = apps.FirstOrDefault();
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

+28 -12
View File
@@ -1,8 +1,9 @@
import Localization from 'zero/services/localization';
import { isArray as _isArray } from 'underscore';
// set meta title before routing
const beforeEach = () => (to, from, next) =>
const beforeEach = (to, from, next) =>
{
let isGuarded = false;
@@ -10,24 +11,39 @@ const beforeEach = () => (to, from, next) =>
let callback = () =>
{
let title = Localization.localize('@zero.name');
let name = to.meta.name;
if (to.meta.name && to.meta.alias !== __zero.alias.sections.dashboard)
if (!name && to.matched.length > 1)
{
let name = to.meta.name;
let nameParts = _isArray(name) ? name : [name];
let translations = [];
nameParts.forEach(part =>
to.matched.forEach(route =>
{
if (part)
if (!name && route.meta.name)
{
translations.push(Localization.localize(part));
name = route.meta.name;
}
});
title += ': ' + translations.join(' - ');
}
if (!name || to.meta.alias === __zero.alias.sections.dashboard)
{
document.title = title;
next();
return;
}
let nameParts = _isArray(name) ? name : [name];
let translations = [];
nameParts.forEach(part =>
{
if (part)
{
translations.push(Localization.localize(part));
}
});
title += ': ' + translations.join(' - ');
document.title = title;
next();
@@ -67,7 +83,7 @@ export default {
base: __zero.path,
linkActiveClass: 'is-active',
linkExactActiveClass: 'is-active-exact',
//beforeEach: beforeEach,
beforeEach: beforeEach,
scrollBehavior(to, from, savedPosition)
{
return savedPosition ? savedPosition : { x: 0, y: 0 };
+2 -2
View File
@@ -75,11 +75,11 @@ class Zero
routes: this.#routes
});
this.#router.beforeEach(routerConfig.beforeEach);
//const result = await Axios.get('zerovue/config');
//this.config = { ...this.config, ...result.data };
//console.info(this.#vue.router);
this.#setupDone = true;
//EventHub.$emit('zero.setup');
}
+5 -5
View File
@@ -33,7 +33,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) =
path: area.url,
component: component,
meta: {
name: [area.name, section.name]
name: area.name
}
});
@@ -46,7 +46,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) =
component: detailComponent,
meta: {
create: true,
name: [area.name, section.name]
name: area.name
}
});
}
@@ -59,7 +59,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) =
props: true,
component: detailComponent,
meta: {
name: [area.name, section.name]
name: area.name
}
});
}
@@ -105,7 +105,7 @@ if (section)
component: UserRole,
meta: {
create: true,
name: [area.name, section.name]
name: area.name
}
});
@@ -115,7 +115,7 @@ if (section)
props: true,
component: UserRole,
meta: {
name: [area.name, section.name]
name: area.name
}
});
});
+5
View File
@@ -27,6 +27,11 @@ module.exports = {
app: "app.js"
},
devServer: {
sockPath: '/zero/vue-cli/sockjs-node',
public: 'http://localhost:2310/zero/vue-cli'
},
// webpack configuration
chainWebpack: config =>
{
+3
View File
@@ -10,6 +10,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="expires" content="0">
<link rel="icon" type="image/png" href="/assets/zero-icon.png" sizes="32x32">
<link rel="image_src" type="image/png" href="/assets/zero-icon.png" sizes="192x192" />
<link rel="shortcut icon" type="image/png" href="/assets/zero-icon.png" sizes="196x196">
<base href="~/">
<environment exclude="Development">
<link href="~/zero/Assets/app.css" rel="stylesheet" asp-append-version="true" />