fix: 修改删除按钮,压缩图片
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 19 KiB |
@ -79,11 +79,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { renderIcon, goDialog, requireUrl, requireFallbackImg } from '@/utils'
|
import { renderIcon, requireUrl, requireFallbackImg } from '@/utils'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import { AppleControlBtn } from '@/components/AppleControlBtn'
|
import { AppleControlBtn } from '@/components/AppleControlBtn'
|
||||||
import { useMessage, useDialog } from 'naive-ui'
|
import { useMessage, useDialog } from 'naive-ui'
|
||||||
import { DialogEnum } from '@/enums/pluginEnum'
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
EllipsisHorizontalCircleSharpIcon,
|
EllipsisHorizontalCircleSharpIcon,
|
||||||
@ -99,7 +98,7 @@ const {
|
|||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
const emit = defineEmits(['resize'])
|
const emit = defineEmits(['delete', 'resize'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
cardData: Object
|
cardData: Object
|
||||||
@ -160,20 +159,19 @@ const selectOptions = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const handleSelect = (key: string) => {
|
const handleSelect = (key: string) => {
|
||||||
console.log(key)
|
switch (key) {
|
||||||
|
case 'delete':
|
||||||
|
deleteHanlde()
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除处理
|
// 删除处理
|
||||||
const deleteHanlde = () => {
|
const deleteHanlde = () => {
|
||||||
goDialog({
|
emit('delete', props.cardData)
|
||||||
type: DialogEnum.delete,
|
|
||||||
promise: true,
|
|
||||||
onPositiveCallback: () =>
|
|
||||||
new Promise(res => setTimeout(() => res(1), 1000)),
|
|
||||||
promiseResCallback: (e: any) => {
|
|
||||||
window.$message.success('删除成功')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 放大处理
|
// 放大处理
|
||||||
|
@ -6,8 +6,12 @@
|
|||||||
cols="2 s:2 m:3 l:4 xl:4 xxl:4"
|
cols="2 s:2 m:3 l:4 xl:4 xxl:4"
|
||||||
responsive="screen"
|
responsive="screen"
|
||||||
>
|
>
|
||||||
<n-grid-item v-for="item in list" :key="item.id">
|
<n-grid-item v-for="(item, index) in list" :key="item.id">
|
||||||
<Card :cardData="item" @resize="resizeHandle" />
|
<Card
|
||||||
|
:cardData="item"
|
||||||
|
@resize="resizeHandle"
|
||||||
|
@delete="deleteHandle($event, index)"
|
||||||
|
/>
|
||||||
</n-grid-item>
|
</n-grid-item>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
</div>
|
</div>
|
||||||
@ -18,11 +22,13 @@
|
|||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import { Card } from '../Card/index'
|
import { Card } from '../Card/index'
|
||||||
import { ModalCard } from '../ModalCard/index'
|
import { ModalCard } from '../ModalCard/index'
|
||||||
|
import { goDialog } from '@/utils'
|
||||||
|
import { DialogEnum } from '@/enums/pluginEnum'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
const { CopyIcon, EllipsisHorizontalCircleSharpIcon } = icon.ionicons5
|
const { CopyIcon, EllipsisHorizontalCircleSharpIcon } = icon.ionicons5
|
||||||
|
|
||||||
const list = reactive([
|
const list = ref([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
title: '物料1',
|
title: '物料1',
|
||||||
@ -53,6 +59,20 @@ const list = reactive([
|
|||||||
const modalData = ref({})
|
const modalData = ref({})
|
||||||
const modalShow = ref(false)
|
const modalShow = ref(false)
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const deleteHandle = (cardData: object, index: number) => {
|
||||||
|
goDialog({
|
||||||
|
type: DialogEnum.delete,
|
||||||
|
promise: true,
|
||||||
|
onPositiveCallback: () =>
|
||||||
|
new Promise(res => setTimeout(() => res(1), 1000)),
|
||||||
|
promiseResCallback: (e: any) => {
|
||||||
|
window.$message.success('删除成功')
|
||||||
|
list.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭 modal
|
// 关闭 modal
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
modalShow.value = false
|
modalShow.value = false
|
||||||
@ -63,7 +83,6 @@ const resizeHandle = (cardData: object) => {
|
|||||||
modalShow.value = true
|
modalShow.value = true
|
||||||
modalData.value = cardData
|
modalData.value = cardData
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|