feat: 重构 PrimeVue 相关插件,优化对话框和通知服务的使用,更新样式和组件结构
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<script lang="ts"></script>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { ConfirmationService, DialogService, ToastService, useDialogRef } from '@/utils/primevue';
|
||||
import { ConfirmationService, DialogService, ToastService, useDialogRef } from '@/plugins/primevue';
|
||||
import dialogContent from './dialog-content.vue';
|
||||
|
||||
const dynamicComponent = defineComponent({
|
||||
@ -61,6 +61,7 @@ const openDialog = async () => {
|
||||
};
|
||||
const openToast = () => {
|
||||
ToastService.add({ severity: 'info', summary: '提示', detail: '消息内容', life: 3000 });
|
||||
ToastService.add({ severity: 'info', summary: '提示', detail: '消息内容', life: 0 });
|
||||
};
|
||||
const openConfirm = async () => {
|
||||
ConfirmationService.require({
|
||||
@ -77,25 +78,54 @@ const openConfirm = async () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const onAdvancedUpload = () => {
|
||||
ToastService.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="primevue">
|
||||
<InputText placeholder="请输入" />
|
||||
<Select
|
||||
:options="[
|
||||
{ name: '纽约', code: 'NY' },
|
||||
{ name: '罗马', code: 'RM' },
|
||||
{ name: '伦敦', code: 'LDN' },
|
||||
{ name: '伊斯坦布尔', code: 'IST' },
|
||||
{ name: '巴黎', code: 'PRS' },
|
||||
]"
|
||||
optionLabel="name"
|
||||
placeholder="选择城市"
|
||||
class="min-w-[200px]"
|
||||
/>
|
||||
<div class="primevue p-4 flex flex-wrap gap-6">
|
||||
<FloatLabel>
|
||||
<InputText default-value="DEFAULT_VALUE" id="username" />
|
||||
<label for="username">Username</label>
|
||||
</FloatLabel>
|
||||
|
||||
<DatePicker dateFormat="dd/mm/yy" />
|
||||
<FloatLabel>
|
||||
<Select
|
||||
:options="[
|
||||
{ name: '纽约', code: 'NY' },
|
||||
{ name: '罗马', code: 'RM' },
|
||||
{ name: '伦敦', code: 'LDN' },
|
||||
{ name: '伊斯坦布尔', code: 'IST' },
|
||||
{ name: '巴黎', code: 'PRS' },
|
||||
]"
|
||||
optionLabel="name"
|
||||
class="min-w-[200px]"
|
||||
/>
|
||||
<label>SELECT</label>
|
||||
</FloatLabel>
|
||||
|
||||
<FloatLabel>
|
||||
<FileUpload
|
||||
name="demo[]"
|
||||
url="/api/upload"
|
||||
@upload="onAdvancedUpload()"
|
||||
:multiple="true"
|
||||
accept="image/*"
|
||||
:maxFileSize="1000000"
|
||||
>
|
||||
<template #empty>
|
||||
<span>Drag and drop files to here to upload.</span>
|
||||
</template>
|
||||
</FileUpload>
|
||||
<label>FileUpload</label>
|
||||
</FloatLabel>
|
||||
|
||||
<FloatLabel>
|
||||
<DatePicker showButtonBar dateFormat="dd/mm/yy" :default-value="new Date()" />
|
||||
<label>DatePicker</label>
|
||||
</FloatLabel>
|
||||
|
||||
<Button @click="openToast">提示服务</Button>
|
||||
<Button @click="openDialog">对话框服务</Button>
|
||||
|
Reference in New Issue
Block a user