1.0 KiB
1.0 KiB
Global Utilities
$baseMessage
A global message utility function that provides a consistent way to display messages across the application.
Usage
In Vue components, you can use it via the component instance:
// In setup()
import { getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance() || { proxy: null };
// Then use it
proxy?.$baseMessage('Operation successful', 'success');
Parameters
message: string - The message content to displaytype: 'success' | 'error' | 'warning' | 'info' = 'info' - The type of message
Examples
// Success message
proxy?.$baseMessage('Operation successful', 'success');
// Error message
proxy?.$baseMessage('Operation failed', 'error');
// Warning message
proxy?.$baseMessage('Warning: This action cannot be undone', 'warning');
// Info message (default)
proxy?.$baseMessage('System will be updated at midnight');
Implementation
The function is implemented in src/utils/message.ts and registered globally in src/plugins/globalProperties.ts.