提交 c5c5d7d9 编写于 作者: View Design's avatar View Design

add

上级 365ecb6a
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<NuxtPage /> <NuxtPage />
</NuxtLayout> </NuxtLayout>
<UNotifications /> <UNotifications />
<UModals />
</template> </template>
<script setup> <script setup>
const { $updateUserInfo } = useUserStore() const { $updateUserInfo } = useUserStore()
......
<template>
<UModal :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<div class="flex p-6 gap-4">
<div class="flex">
<div class="mx-auto flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-red-100">
<UIcon name="i-heroicons-exclamation-triangle" class="w-6 h-6 text-red-600" />
</div>
</div>
<div class="flex-grow flex flex-col">
<div class="text-base leading-6 text-gray-900 truncate">{{ title }}</div>
<div class="mt-2 text-sm text-gray-500">{{ description }}</div>
</div>
</div>
<div class="p-4 flex justify-end gap-2">
<UButton color="white" @click="handleCancel">取消</UButton>
<UButton color="red" @click="handleSuccess">确定</UButton>
</div>
</UModal>
</template>
<script setup>
defineProps({
title: {
type: String,
default: ''
},
description: {
type: String,
default: '确认要全部清空吗?'
},
async: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['success', 'cancel'])
function handleCancel () {
emits('cancel')
}
function handleSuccess () {
emits('success')
}
</script>
...@@ -87,16 +87,28 @@ ...@@ -87,16 +87,28 @@
</UModal> </UModal>
</template> </template>
<script setup> <script setup>
import { IConfirm } from '#components'
const emits = defineEmits(['sign', 'clear']) const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout') const Layout = inject('Layout')
const modal = useModal()
const { $isSignIn } = storeToRefs(useUserStore()) const { $isSignIn } = storeToRefs(useUserStore())
const { $searchHistory } = storeToRefs(useSearchStore()) const { $searchHistory } = storeToRefs(useSearchStore())
const { $getSearchHistory } = useSearchStore() const { $getSearchHistory } = useSearchStore()
const isOpenHistory = ref(false) const isOpenHistory = ref(false)
const query = ref('') const query = ref('')
function handleClear () { function handleClear () {
modal.open(IConfirm, {
title: '清空确认',
description: '确定要清空全部搜索记录吗?',
onSuccess () {
modal.close()
emits('clear') emits('clear')
handleRemoveRecords() handleRemoveRecords()
},
onCancel () {
modal.close()
}
})
} }
function handleRemoveRecordItem (id) { function handleRemoveRecordItem (id) {
handleRemoveRecords([id]) handleRemoveRecords([id])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册