vuepress-plugin-twikoo 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Comment.vue +1 -1
- package/index.js +6 -1
- package/package.json +1 -1
package/Comment.vue
CHANGED
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
needComment(frontmatter) {
|
|
54
|
-
return frontmatter.twikoo !== false
|
|
54
|
+
return frontmatter.twikoo !== false && (TWIKOO_OPTIONS.pathPrefix.some(prefix => this.$route.path.startsWith(prefix)));
|
|
55
55
|
},
|
|
56
56
|
|
|
57
57
|
// 基础移动逻辑(抽离成独立函数)
|
package/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
|
|
3
3
|
module.exports = (opts, ctx) => {
|
|
4
|
+
const TWIKOO_OPTIONS = {
|
|
5
|
+
// 合并默认值和用户配置,确保 pathPrefix 必为数组
|
|
6
|
+
...opts.options,
|
|
7
|
+
pathPrefix: Array.isArray(opts.options?.pathPrefix) ? opts.options.pathPrefix : ['/']
|
|
8
|
+
};
|
|
4
9
|
return {
|
|
5
10
|
define: {
|
|
6
|
-
TWIKOO_OPTIONS
|
|
11
|
+
TWIKOO_OPTIONS,
|
|
7
12
|
TWIKOO_CONTAINER: opts.container || 'main.page'
|
|
8
13
|
},
|
|
9
14
|
enhanceAppFiles: path.resolve(__dirname, 'comment.js'),
|