Skip to content

Configuration Options

Global Configuration Options

For certain configurations, such as enabling keyboard events or closing the preview by clicking the mask layer, you may want to maintain consistency globally but need to repeatedly configure them for each invocation. To solve this problem, we provide global configuration options. You can pass the global configuration options as the second parameter when importing the plugin, avoiding repetitive configurations for each invocation.

TIP

Since the usage of configuration options is similar in Vue 2 and Vue 3, this chapter will not distinguish between them.

js
// main.js
Vue.use(hevueImgPreview, options)

Local Configuration Options

The parameters passed when using the plugin within a component are called local configuration options. The plugin also provides default values for most configuration options. Their priority is as follows:

Priority

The priority of configuration options is Component-level configuration > Global configuration > Default values

Options

Below is a list of all configuration options for quick reference. If you have questions about a specific option, you can refer to the detailed explanations later in this document.

Property NameDescriptionTypeDefault ValueDetailed Explanation
imgListArray of image URLs for previewarray-Multiple Image Preview
nowImgIndexIndex of the currently displayed image when passing multiple imagesnumber0Multiple Image Preview
thumbnailEnable thumbnailsbooleantrueMultiple Image Preview
controlBarConfiguration for the bottom control bararray[]Control Bar
closeBtnShow the top-right close buttonbooleantrue-
arrowBtnShow left and right navigation buttonsbooleantrue-
clickMaskCloseClose the preview by clicking the mask layerbooleantrue-
disabledImgRightClickDisable right-click on imagesbooleanfalse-
disableTransitionDisable transition effectsbooleanfalseAppearance and Transition
customStyleCustom stylesobject-Appearance and Transition
themeNameTheme namestring-Appearance and Transition
zIndexPlug-in levelnumber9999-
closeFnCallback function when the plugin is closedFunction-Close Event
changeFnCallback function for image switchingFunction-
Image Switch Event
localeLanguagestringzhCNzhCN: 中文
en: English