vue-m-message is a lightweight and configurable message/toast plugin designed specifically for Vue.js applications. The current stable version, v4.0.2, exclusively supports Vue 3, having been fully refactored with TypeScript since v4.0.0. For Vue 2 projects, users must install the v3.x series. It offers various message types (info, success, error, warning, loading), supports custom icons, HTML content, and provides 7 distinct positioning options. It also allows for programmatic closing and setting global default options, differentiating itself through its explicit Vue 3 focus, modern composition API integration, and flexible content rendering, including VNode support, without significant external dependencies.
npm install vue-m-messageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates setting up a basic Vue 3 application, installing `vue-m-message` as a plugin with global default options, importing its styles, and then programmatically displaying a rich, custom-styled info message using Vue's H function.
For Vue 2 projects, install `npm install vue-m-message@3`. For Vue 3 projects, ensure your Vue environment is correctly configured for Vue 3.
Review type definitions and adapt your TypeScript code as necessary to align with the new type signatures. Ensure your project's `tsconfig.json` is configured appropriately for Vue 3 and TypeScript.
If experiencing unexpected behavior with message closing or duration, explicitly set `duration: -1` for persistent messages and `closable: true` to enable the close button. Refer to the v4.x documentation for the latest attribute behaviors.
If using Vue 2, downgrade to `npm install vue-m-message@3`. If using Vue 3, ensure you have called `app.use(Message)` in your main application entry point before mounting the app.
Verify that `import Message from 'vue-m-message'` is present and correct, and that `app.use(Message)` has been executed before any calls to `Message.info()` or other methods. Ensure you are calling `Message.info()` directly, not `this.$message.info()` unless you've configured a global property.
Add `import 'vue-m-message/dist/style.css'` to your application's main entry file (e.g., `main.ts` or `main.js`).