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