使用用例

import { Message } from 'genshin-ui';
<template>
  <GButton class="w-150 mg-10" type="shrink" icon="round" balance @click="() => Message.success('Success')">Success</GButton>
  <GButton class="w-150 mg-10" type="shrink" icon="round" balance @click="() => Message.info('Info')">Info</GButton>
  <GButton class="w-150 mg-10" type="shrink" icon="round" balance @click="() => Message.error('Error')">Error</GButton>
  <GButton class="w-150 mg-10" type="shrink" icon="round" balance @click="() => Message.clear()">清除</GButton>
</template>
<script setup>
  import { Message } from '@shi-zhong/genshin-ui'
</script>

类型定义


export type Message = {
  msg: (
    msg: string | number,
    option?: {
      type?: 'success' | 'info' | 'error'
      duration?: number
    }
  ) => void;
  success: (msg: string | number, duration?: number) => void;
  info: (msg: string | number, duration?: number) => void;
  error: (msg: string | number, duration?: number) => void;
  clear: () => void;
}
Last Updated:
Contributors: shi-zhong