From e3ab9c6b8603d950fc0b8beabe17a233e87ed0ca Mon Sep 17 00:00:00 2001 From: Arthur Darkstone Date: Fri, 15 Nov 2024 20:56:11 +0800 Subject: [PATCH] feat: add 3 resize examples --- .../src/views/examples/resize/basic.vue | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/playground/src/views/examples/resize/basic.vue b/playground/src/views/examples/resize/basic.vue index a8fcd0dc0a2..6295839a62e 100644 --- a/playground/src/views/examples/resize/basic.vue +++ b/playground/src/views/examples/resize/basic.vue @@ -3,42 +3,56 @@ import { ref } from 'vue'; import { Page, VResize } from '@vben/common-ui'; -const width = ref(200); -const height = ref(200); -const top = ref(200); -const left = ref(200); +const colorMap = ['red', 'green', 'yellow', 'gray']; -const resize = (newRect: { +type TSize = { height: number; left: number; top: number; width: number; -}) => { - width.value = newRect.width; - height.value = newRect.height; - top.value = newRect.top; - left.value = newRect.left; +}; + +const sizeList = ref([ + { height: 200, left: 200, top: 200, width: 200 }, + { height: 300, left: 300, top: 300, width: 300 }, + { height: 400, left: 400, top: 400, width: 400 }, + { height: 500, left: 500, top: 500, width: 500 }, +]); + +const resize = (size?: TSize, rect?: TSize) => { + if (!size || !rect) return; + + size.height = rect.height; + size.left = rect.left; + size.top = rect.top; + size.width = rect.width; };