fix(plugin): fix page can not get version data (#2237)

pull/2238/head
Fatpandac 3 years ago committed by GitHub
parent ea18c47649
commit 1b2f8cbe68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,20 +14,16 @@ exports.loadVersionPlugin = () => {
.then((res) => res.response.docs[0].latestVersion);
};
const version = pom.project.properties.revision._text;
var version = pom.project.properties.revision._text;
return {
name: "vuepress-plugin-loadVersion",
extendsPage: async (page) => {
const injectVersionPagePaths = ["/", "/en/"];
if (!injectVersionPagePaths.includes(page.data.path)) return;
onInitialized: async (app) => {
if (version.includes("SNAPSHOT")) {
page.data.version = await getVersionByMaven();
} else {
page.data.version = version;
version = await getVersionByMaven();
}
app.pages.map((page) => (page.data.version = version));
},
};
};

Loading…
Cancel
Save