Commit 22dfee7d1d0bea8549d18a20562e9d7687aca270
Merge branch 'fix/page-title' into 'main_dev'
fix: 修复刷新页面页标题显示问题 See merge request yunteng/thingskit-view!293
Showing
2 changed files
with
33 additions
and
26 deletions
1 | -import { Plugin } from 'vite' | ||
2 | -import { createHtmlPlugin } from 'vite-plugin-html' | 1 | +import { HtmlTagDescriptor, Plugin } from 'vite' |
2 | +// import { createHtmlPlugin } from 'vite-plugin-html' | ||
3 | 3 | ||
4 | const GLOB_CONFIG_FILE_NAME = '_app.config.js' | 4 | const GLOB_CONFIG_FILE_NAME = '_app.config.js' |
5 | 5 | ||
@@ -10,34 +10,45 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean): Plugin { | @@ -10,34 +10,45 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean): Plugin { | ||
10 | return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${Date.now()}` | 10 | return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${Date.now()}` |
11 | } | 11 | } |
12 | 12 | ||
13 | - const htmlPlugin = createHtmlPlugin({ | ||
14 | - minify: isBuild, | ||
15 | - inject: { | ||
16 | - data: { | ||
17 | - title: VITE_GLOB_APP_TITLE, | ||
18 | - }, | ||
19 | - tags: isBuild ? [ | ||
20 | - { | ||
21 | - tag: 'script', | ||
22 | - attrs: { src: getAppConfigSrc() } | ||
23 | - } | ||
24 | - ] : [] | ||
25 | - } | ||
26 | - }) | 13 | + // const htmlPlugin = createHtmlPlugin({ |
14 | + // minify: isBuild, | ||
15 | + // inject: { | ||
16 | + // data: { | ||
17 | + // title: VITE_GLOB_APP_TITLE, | ||
18 | + // }, | ||
19 | + // tags: isBuild ? [ | ||
20 | + // { | ||
21 | + // tag: 'script', | ||
22 | + // attrs: { src: getAppConfigSrc() } | ||
23 | + // } | ||
24 | + // ] : [] | ||
25 | + // } | ||
26 | + // }) | ||
27 | + | ||
27 | 28 | ||
28 | 29 | ||
30 | + const tags:HtmlTagDescriptor[] = [ | ||
31 | + { | ||
32 | + tag: 'title', | ||
33 | + children: VITE_GLOB_APP_TITLE | ||
34 | + } | ||
35 | + ] | ||
29 | 36 | ||
37 | + if (isBuild) { | ||
38 | + tags.push( | ||
39 | + { | ||
40 | + tag: 'script', | ||
41 | + attrs: { src: getAppConfigSrc() } | ||
42 | + } | ||
43 | + ) | ||
44 | + } | ||
30 | return { | 45 | return { |
31 | name: 'html-plugin', | 46 | name: 'html-plugin', |
32 | transformIndexHtml: (code, ctx) => { | 47 | transformIndexHtml: (code, ctx) => { |
48 | + | ||
33 | return { | 49 | return { |
34 | html: code, | 50 | html: code, |
35 | - tags: isBuild ? [ | ||
36 | - { | ||
37 | - tag: 'script', | ||
38 | - attrs: { src: getAppConfigSrc() } | ||
39 | - } | ||
40 | - ] : [] | 51 | + tags |
41 | } | 52 | } |
42 | }, | 53 | }, |
43 | 54 |
@@ -11,9 +11,6 @@ | @@ -11,9 +11,6 @@ | ||
11 | <meta name="viewport" | 11 | <meta name="viewport" |
12 | content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> | 12 | content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> |
13 | <link rel="icon" href="./favicon.ico" /> | 13 | <link rel="icon" href="./favicon.ico" /> |
14 | - <title> | ||
15 | - <%= title %> | ||
16 | - </title> | ||
17 | <!-- <link rel="stylesheet" href="./index.css" /> --> | 14 | <!-- <link rel="stylesheet" href="./index.css" /> --> |
18 | <style> | 15 | <style> |
19 | * { | 16 | * { |
@@ -114,7 +111,6 @@ | @@ -114,7 +111,6 @@ | ||
114 | opacity: 1; | 111 | opacity: 1; |
115 | } | 112 | } |
116 | } | 113 | } |
117 | - | ||
118 | </style> | 114 | </style> |
119 | </head> | 115 | </head> |
120 | 116 |