mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-12-15 14:50:29 +08:00
Compare commits
2 Commits
244211c4eb
...
f7bf20af97
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7bf20af97 | ||
|
|
1b7c0577d9 |
@@ -3,15 +3,13 @@ import type { App, Component } from "vue";
|
||||
import {
|
||||
/**
|
||||
* 为了方便演示平台将 element-plus 导出的所有组件引入,实际使用中如果你没用到哪个组件,将其注释掉就行
|
||||
* 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/component.ts#L111-L211
|
||||
* 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/component.ts#L116-L226
|
||||
* */
|
||||
ElAffix,
|
||||
ElAlert,
|
||||
ElAutocomplete,
|
||||
ElAutoResizer,
|
||||
ElAvatar,
|
||||
ElAnchor,
|
||||
ElAnchorLink,
|
||||
ElBacktop,
|
||||
ElBadge,
|
||||
ElBreadcrumb,
|
||||
@@ -32,6 +30,7 @@ import {
|
||||
ElCollapse,
|
||||
ElCollapseItem,
|
||||
ElCollapseTransition,
|
||||
ElColorPickerPanel,
|
||||
ElColorPicker,
|
||||
ElConfigProvider,
|
||||
ElContainer,
|
||||
@@ -40,6 +39,7 @@ import {
|
||||
ElHeader,
|
||||
ElMain,
|
||||
ElDatePicker,
|
||||
ElDatePickerPanel,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElDialog,
|
||||
@@ -56,6 +56,7 @@ import {
|
||||
ElImageViewer,
|
||||
ElInput,
|
||||
ElInputNumber,
|
||||
ElInputTag,
|
||||
ElLink,
|
||||
ElMenu,
|
||||
ElMenuItem,
|
||||
@@ -107,17 +108,22 @@ import {
|
||||
ElWatermark,
|
||||
ElTour,
|
||||
ElTourStep,
|
||||
ElAnchor,
|
||||
ElAnchorLink,
|
||||
ElSegmented,
|
||||
ElMention,
|
||||
ElSplitter,
|
||||
ElSplitterPanel,
|
||||
/**
|
||||
* 为了方便演示平台将 element-plus 导出的所有插件引入,实际使用中如果你没用到哪个插件,将其注释掉就行
|
||||
* 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/plugin.ts#L11-L16
|
||||
* */
|
||||
ElLoading, // v-loading 指令
|
||||
ElInfiniteScroll, // v-infinite-scroll 指令
|
||||
ElPopoverDirective, // v-popover 指令
|
||||
ElLoading, // v-loading 指令
|
||||
ElMessage, // $message 全局属性对象globalProperties
|
||||
ElMessageBox, // $msgbox、$alert、$confirm、$prompt 全局属性对象globalProperties
|
||||
ElNotification // $notify 全局属性对象globalProperties
|
||||
ElNotification, // $notify 全局属性对象globalProperties
|
||||
ElPopoverDirective // v-popover 指令
|
||||
} from "element-plus";
|
||||
|
||||
const components = [
|
||||
@@ -126,8 +132,6 @@ const components = [
|
||||
ElAutocomplete,
|
||||
ElAutoResizer,
|
||||
ElAvatar,
|
||||
ElAnchor,
|
||||
ElAnchorLink,
|
||||
ElBacktop,
|
||||
ElBadge,
|
||||
ElBreadcrumb,
|
||||
@@ -148,6 +152,7 @@ const components = [
|
||||
ElCollapse,
|
||||
ElCollapseItem,
|
||||
ElCollapseTransition,
|
||||
ElColorPickerPanel,
|
||||
ElColorPicker,
|
||||
ElConfigProvider,
|
||||
ElContainer,
|
||||
@@ -156,6 +161,7 @@ const components = [
|
||||
ElHeader,
|
||||
ElMain,
|
||||
ElDatePicker,
|
||||
ElDatePickerPanel,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElDialog,
|
||||
@@ -172,6 +178,7 @@ const components = [
|
||||
ElImageViewer,
|
||||
ElInput,
|
||||
ElInputNumber,
|
||||
ElInputTag,
|
||||
ElLink,
|
||||
ElMenu,
|
||||
ElMenuItem,
|
||||
@@ -223,16 +230,21 @@ const components = [
|
||||
ElWatermark,
|
||||
ElTour,
|
||||
ElTourStep,
|
||||
ElSegmented
|
||||
ElAnchor,
|
||||
ElAnchorLink,
|
||||
ElSegmented,
|
||||
ElMention,
|
||||
ElSplitter,
|
||||
ElSplitterPanel
|
||||
];
|
||||
|
||||
const plugins = [
|
||||
ElLoading,
|
||||
ElInfiniteScroll,
|
||||
ElPopoverDirective,
|
||||
ElLoading,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
ElNotification
|
||||
ElNotification,
|
||||
ElPopoverDirective
|
||||
];
|
||||
|
||||
/** 按需引入`element-plus` */
|
||||
|
||||
@@ -4,6 +4,13 @@ import { type MessageHandler, ElMessage } from "element-plus";
|
||||
|
||||
type messageStyle = "el" | "antd";
|
||||
type messageTypes = "info" | "success" | "warning" | "error";
|
||||
type messagePlacement =
|
||||
| "top"
|
||||
| "top-left"
|
||||
| "top-right"
|
||||
| "bottom"
|
||||
| "bottom-left"
|
||||
| "bottom-right";
|
||||
|
||||
interface MessageParams {
|
||||
/** 消息类型,可选 `info` 、`success` 、`warning` 、`error` ,默认 `info` */
|
||||
@@ -20,8 +27,10 @@ interface MessageParams {
|
||||
duration?: number;
|
||||
/** 是否显示关闭按钮,默认值 `false` */
|
||||
showClose?: boolean;
|
||||
/** `Message` 距离窗口顶部的偏移量,默认 `16` */
|
||||
/** `Message` 消息距离窗口边缘的偏移量,默认 `16` */
|
||||
offset?: number;
|
||||
/** `Message` 消息放置位置,默认 `top` */
|
||||
placement?: messagePlacement;
|
||||
/** 设置组件的根元素,默认 `document.body` */
|
||||
appendTo?: string | HTMLElement;
|
||||
/** 合并内容相同的消息,不支持 `VNode` 类型的消息,默认值 `false` */
|
||||
@@ -56,6 +65,7 @@ const message = (
|
||||
duration = 2000,
|
||||
showClose = false,
|
||||
offset = 16,
|
||||
placement = "top",
|
||||
appendTo = document.body,
|
||||
grouping = false,
|
||||
repeatNum = 1,
|
||||
@@ -71,6 +81,7 @@ const message = (
|
||||
duration,
|
||||
showClose,
|
||||
offset,
|
||||
placement,
|
||||
appendTo,
|
||||
grouping,
|
||||
repeatNum,
|
||||
|
||||
@@ -199,6 +199,31 @@ defineOptions({
|
||||
|
||||
<el-divider />
|
||||
|
||||
<h4 class="mb-4!">
|
||||
控制消息出现的位置,消息可以显示在窗口的顶部(默认) 或其他位置
|
||||
</h4>
|
||||
|
||||
<el-space wrap>
|
||||
<el-button @click="message('顶部中间')"> 顶部中间 </el-button>
|
||||
<el-button @click="message('顶部左侧', { placement: 'top-left' })">
|
||||
顶部左侧
|
||||
</el-button>
|
||||
<el-button @click="message('顶部右侧', { placement: 'top-right' })">
|
||||
顶部右侧
|
||||
</el-button>
|
||||
<el-button @click="message('底部中间', { placement: 'bottom' })">
|
||||
底部中间
|
||||
</el-button>
|
||||
<el-button @click="message('底部左侧', { placement: 'bottom-left' })">
|
||||
底部左侧
|
||||
</el-button>
|
||||
<el-button @click="message('底部右侧', { placement: 'bottom-right' })">
|
||||
底部右侧
|
||||
</el-button>
|
||||
</el-space>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<el-button @click="closeAllMessage"> 关闭所有消息提示 </el-button>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user