vue-layer is a Vue 2 component library for creating modal dialogs, alerts, confirmations, prompts, tooltips, and iframe-like layers, modeled after layui's layer plugin. Current stable version is 1.2.5, released on npm. It extends Vue prototype with $layer methods. Key differentiators: includes a custom iframe layer using Vue components instead of actual iframes, supports maximizable/minimizable windows, and provides simple API similar to layui. It is designed only for Vue 2 and requires manual CSS import. No major updates since 2019; maintenance status is low.
npm install vue-layerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install vue-layer as a plugin and display a simple alert dialog.
Always use Vue.prototype.$layer = layer(Vue) in entry file.
Use alternatives like element-ui or ant-design-vue for Vue 3.
For external URLs, use a different library or native iframe.
Add import 'vue-layer/lib/vue-layer.css' in your entry file.
Use formType: 1, 2, or 3 when calling layer.prompt.
Ensure Vue.prototype.$layer = layer(Vue) is called before any component uses $layer.
Use this.$layer.alert() instead of <layer> tags.
Register the component in the parent component's components option.
Use path: 'vue-layer/lib/vue-layer.css' (note: 'lib' not 'dist').