Skip to content

Commit

Permalink
fix(router): fix the new page router
Browse files Browse the repository at this point in the history
cancel use addRoute method
  • Loading branch information
xcyeye committed Oct 20, 2021
1 parent db07b5e commit 959cf58
Show file tree
Hide file tree
Showing 11 changed files with 1,910 additions and 47 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
@@ -1,4 +1,13 @@
# [1.0.0](https://github.com/qsyyke/vuepress-theme-aurora/compare/v1.3.5...v1.0.0) (2021-10-16)
# [1.0.0](https://github.com/qsyyke/vuepress-theme-aurora/compare/v1.3.6...v1.0.0) (2021-10-18)



## [1.3.6](https://github.com/qsyyke/vuepress-theme-aurora/compare/v1.3.5...v1.3.6) (2021-10-18)


### Bug Fixes

* **view:** fix the mobile sidebar and mood ([db07b5e](https://github.com/qsyyke/vuepress-theme-aurora/commit/db07b5efdfa21e65d57845c3e06e648e6e6db8c2))



Expand Down
16 changes: 16 additions & 0 deletions deploy-dist.sh
@@ -0,0 +1,16 @@
# 生成静态文件
npm run build

# 进入生成的文件夹
cd docs/.vuepress/dist

echo 'theme-test.cco.vin' > CNAME

git init
git add -A
git commit -m 'deploy'

# 如果发布到 https://<USERNAME>.github.io
git push -f https://github.com/qsyyke/theme-test.git master:gh-pages

cd -
8 changes: 4 additions & 4 deletions docs/.vuepress/config.js
Expand Up @@ -42,15 +42,15 @@ module.exports = {
},
],
],
onPrepared: async (app) => {
/*onPrepared: async (app) => {
const myData = app.pages.map((page) => {
return page;
});
await app.writeTemp(
"my-data.js",
`export default ${JSON.stringify(myData)}`
);
},
},*/

theme: path.resolve(__dirname, "theme/lib/node/index.js"),
title: "I do not follow,i lives is always all you want",
Expand All @@ -59,9 +59,9 @@ module.exports = {
port: 8080,
themeConfig,
//build完成之后,会自动退出
onGenerated: (app) => {
/*onGenerated: (app) => {
setTimeout(() => {
process.exit(0)
},3000)
}
}*/
};
40 changes: 5 additions & 35 deletions docs/.vuepress/theme/lib/client/clientAppEnhance.js
Expand Up @@ -43,46 +43,16 @@ export default defineClientAppEnhance(({ app, router }) => {
app.component("AddMood",AddMood)
app.component("HomeSidebar",HomeSidebar)
app.component("HomeBottom",HomeBottom)
app.component("About",About)
app.component("Link",Link)
app.component("Mood",Mood)
app.component("PhotoFall",PhotoFall)
app.component("Tag",Tag)

//路由
// @ts-ignore
app.use(store)

router.addRoute({
path: '/about',
name: 'aurora-about',
component: About
})

router.addRoute({
path: '/link',
name: 'aurora-link',
component: Link
})

router.addRoute({
path: '/tag',
name: 'aurora-tag',
component: Tag
})
router.addRoute({
path: '/mood',
name: 'aurora-time',
component: Mood
})

router.addRoute({
path: '/post',
name: 'aurora-post',
component: Poster
})

router.addRoute({
path: '/photo',
component: PhotoFall,
name: 'aurora-photo'
})

delete app._context.components.OutboundLink;
// override the built-in `<OutboundLink>`
app.component('OutboundLink', OutboundLink);
Expand Down
14 changes: 8 additions & 6 deletions docs/.vuepress/theme/lib/client/public/js/tag.js
Expand Up @@ -39,13 +39,15 @@ module.exports = {
}

//判断是否为说说页面
if (myData.default[i].filePathRelative.search("moods/") !== -1) {
continue
}
if (myData.default[i].filePathRelative !== null) {
if (myData.default[i].filePathRelative.search("moods/") !== -1) {
continue
}

//判断是否为相册页面
if (myData.default[i].filePathRelative.search("photos/") !== -1) {
continue
//判断是否为相册页面
if (myData.default[i].filePathRelative.search("photos/") !== -1) {
continue
}
}

const articleMap = {
Expand Down
1 change: 1 addition & 0 deletions docs/.vuepress/theme/lib/client/utils/index.js
@@ -1,2 +1,3 @@
export * from './resolveEditLink';
export * from './resolveRepoType';

75 changes: 75 additions & 0 deletions docs/.vuepress/theme/lib/node/auroraTheme.js
@@ -1,7 +1,9 @@
"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTheme = void 0;
const { path } = require('@vuepress/utils')
const { createPage } = require('@vuepress/core');
const utils_1 = require("@vuepress/utils");
const utils_2 = require("./utils");
const auroraTheme = ({ themePlugins = {}, ...localeOptions }) => {
Expand All @@ -14,6 +16,79 @@ const auroraTheme = ({ themePlugins = {}, ...localeOptions }) => {
clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
// use the relative file path to generate edit link
extendsPageData: ({ filePathRelative }) => ({ filePathRelative }),
onPrepared: async (app) => {
const myData = app.pages.map((page) => {
return page;
});
await app.writeTemp(
"my-data.js",
`export default ${JSON.stringify(myData)}`
);
},
onInitialized: async (app) => {
// 如果主页不存在
const homepage1 = await createPage(app, {
path: '/about',
// 设置 frontmatter
frontmatter: {
layout: 'About'
},
// 设置 markdown 内容
content: "",
})

const homepage2 = await createPage(app, {
path: '/link',
// 设置 frontmatter
frontmatter: {
layout: 'Link'
},
// 设置 markdown 内容
content: "",
})

const homepage3 = await createPage(app, {
path: '/mood',
// 设置 frontmatter
frontmatter: {
layout: 'Mood'
},
// 设置 markdown 内容
content: "",
})

const homepage4 = await createPage(app, {
path: '/photo',
// 设置 frontmatter
frontmatter: {
layout: 'PhotoFall'
},
// 设置 markdown 内容
content: "",
})

const homepage5 = await createPage(app, {
path: '/tag',
// 设置 frontmatter
frontmatter: {
layout: 'Tag'
},
// 设置 markdown 内容
content: "",
})

// 把它添加到 `app.pages`
app.pages.push(homepage1)
app.pages.push(homepage2)
app.pages.push(homepage3)
app.pages.push(homepage4)
app.pages.push(homepage5)
},
onGenerated: (app) => {
setTimeout(() => {
process.exit(0)
},3000)
},
plugins: [
[
'@vuepress/active-header-links',
Expand Down

0 comments on commit 959cf58

Please sign in to comment.