diff --git a/packages/@vuepress/plugin-medium-zoom/index.js b/packages/@vuepress/plugin-medium-zoom/index.js index 04eea8cdea..639b17d652 100644 --- a/packages/@vuepress/plugin-medium-zoom/index.js +++ b/packages/@vuepress/plugin-medium-zoom/index.js @@ -1,5 +1,8 @@ const { path } = require('@vuepress/shared-utils') -module.exports = { +module.exports = (options, context) => ({ + define: { + SELECTOR: options.selector || '.content img' + }, clientRootMixin: path.resolve(__dirname, 'mixin.js') -} +}) diff --git a/packages/@vuepress/plugin-medium-zoom/mixin.js b/packages/@vuepress/plugin-medium-zoom/mixin.js index 24369a681c..8ca95d5f44 100644 --- a/packages/@vuepress/plugin-medium-zoom/mixin.js +++ b/packages/@vuepress/plugin-medium-zoom/mixin.js @@ -1,10 +1,12 @@ +/* global SELECTOR */ + import './style.css' import zoom from 'medium-zoom' export default { mounted () { setTimeout(() => { - zoom('.content img') + zoom(SELECTOR) }, 1000) } }