An open API service indexing awesome lists of open source software.

https://github.com/lightapis/vue-simple-message

A Vue component that displays notification messages
https://github.com/lightapis/vue-simple-message

component message plugin vue

Last synced: about 1 month ago
JSON representation

A Vue component that displays notification messages

Awesome Lists containing this project

README

          

# vue-simple-message

## Preview

![preview](https://gcore.jsdelivr.net/gh/dragonish/images@main/img/202412022058827.jpg)

## Installation

```shell
npm install vue-simple-message
```

## Usage

### Global registration

In the entry file:

```typescript
import { createApp } from 'vue';
import SimpleMessage from 'vue-simple-message';
import App from './App.vue';

const app = createApp(App);
app.use(SimpleMessage);
app.mount('#app');
```

Example usage:

```html

import { ref } from 'vue';

const list = ref([]);

```

### Direct import

```html

import { ref } from 'vue';
import { SimplePagination, type NotificationItem } from 'vue-simple-message';

const list = ref<NotificationItem[]>([]);

function onClose(id: string) {
// ...
}

```

### Types

```typescript
type NotificationType = 'info' | 'warn' | 'error' | 'debug' | 'custom';

interface NotificationItem {
/** Message ID */
id: string;
/** The type of message */
type: NotificationType;
/** Message content */
content: string;
/** Text color */
color?: string;
/** Window background color */
background?: string;
}
```

## License

[MIT](./LICENSE)