z3by / vuepress-plugin-flexsearch

Next-Generation full text search library for Vuepress
MIT License
42 stars 16 forks source link

why I can't get this.$site.page.content #7

Closed taojunnan closed 4 years ago

taojunnan commented 4 years ago

this repo

// in searchBox.vue/setupFlexSearch()
this.index = new Flexsearch(options);
const { pages } = this.$site;
console.debug('###', pages)
this.index.add(pages);

image

my project vuepress: ^1.2.0 image

taojunnan commented 4 years ago

I know the reason

const { path } = require('@vuepress/shared-utils')

module.exports = (options) => ({
    extendPageData ($page) {
        const {
            _content
        } = $page
        $page.content = _content
    },
    alias: {
        '@SearchBox':
            path.resolve(__dirname, 'SearchBox.vue')
    },
})