feat: add reize components & demo (#4862)

* feat: resize component

* chore: change positon of resize components

* feat: add resize demo

* chore: resize demo completed

* chore: fix display number

* chore: add infer comment

* fix: move reszie demo to examples

* fix: fix icon & removed scss
pull/48/MERGE
Arthur Darkstone 2024-11-13 15:43:17 +08:00 committed by GitHub
parent a89711610d
commit 8cc73cf59c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1210 additions and 27 deletions

View File

@ -222,5 +222,6 @@
"commentTranslate.hover.enabled": false, "commentTranslate.hover.enabled": false,
"commentTranslate.multiLineMerge": true, "commentTranslate.multiLineMerge": true,
"vue.server.hybridMode": true, "vue.server.hybridMode": true,
"typescript.tsdk": "node_modules/typescript/lib" "typescript.tsdk": "node_modules/typescript/lib",
"oxc.enable": false
} }

View File

@ -4,53 +4,55 @@
"language": "en,en-US", "language": "en,en-US",
"allowCompoundWords": true, "allowCompoundWords": true,
"words": [ "words": [
"clsx",
"esno",
"demi",
"unref",
"taze",
"acmr", "acmr",
"antd", "antd",
"lucide", "antdv",
"astro",
"brotli", "brotli",
"clsx",
"defu", "defu",
"demi",
"echarts",
"ependencies",
"esno",
"etag",
"execa", "execa",
"iconify", "iconify",
"iconoir",
"intlify", "intlify",
"lockb",
"lucide",
"minh",
"minw",
"mkdist", "mkdist",
"mockjs", "mockjs",
"vitejs", "naiveui",
"nocheck",
"noopener", "noopener",
"noreferrer", "noreferrer",
"nprogress", "nprogress",
"nuxt",
"pinia", "pinia",
"prefixs",
"publint", "publint",
"qrcode", "qrcode",
"shadcn", "shadcn",
"sonner", "sonner",
"sortablejs",
"styl",
"taze",
"ui-kit",
"uicons",
"unplugin", "unplugin",
"unref",
"vben", "vben",
"vbenjs", "vbenjs",
"vueuse",
"yxxx",
"nuxt",
"lockb",
"astro",
"ui-kit",
"styl",
"vnode",
"nocheck",
"prefixs",
"vitepress",
"antdv",
"ependencies",
"vite", "vite",
"echarts", "vitejs",
"sortablejs", "vitepress",
"etag", "vnode",
"naiveui", "vueuse",
"uicons", "yxxx"
"iconoir"
], ],
"ignorePaths": [ "ignorePaths": [
"**/node_modules/**", "**/node_modules/**",

View File

@ -2,6 +2,7 @@ export * from './captcha';
export * from './ellipsis-text'; export * from './ellipsis-text';
export * from './icon-picker'; export * from './icon-picker';
export * from './page'; export * from './page';
export * from './resize';
export * from '@vben-core/form-ui'; export * from '@vben-core/form-ui';
export * from '@vben-core/popup-ui'; export * from '@vben-core/popup-ui';

View File

@ -0,0 +1 @@
export { default as VResize } from './resize.vue';

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,9 @@
"ellipsis": { "ellipsis": {
"title": "文本省略" "title": "文本省略"
}, },
"resize": {
"title": "拖动调整"
},
"form": { "form": {
"title": "表单", "title": "表单",
"basic": "基础表单", "basic": "基础表单",

View File

@ -228,6 +228,15 @@ const routes: RouteRecordRaw[] = [
title: $t('examples.ellipsis.title'), title: $t('examples.ellipsis.title'),
}, },
}, },
{
name: 'VueResizeDemo',
path: '/demos/resize/basic',
component: () => import('#/views/examples/resize/basic.vue'),
meta: {
icon: 'material-symbols:resize',
title: $t('examples.resize.title'),
},
},
], ],
}, },
]; ];

View File

@ -0,0 +1,44 @@
<script lang="ts" setup>
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 resize = (newRect: {
height: number;
left: number;
top: number;
width: number;
}) => {
width.value = newRect.width;
height.value = newRect.height;
top.value = newRect.top;
left.value = newRect.left;
};
</script>
<template>
<Page description="Resize组件基础示例" title="Resize组件">
<div class="m-4 bg-blue-500 p-48 text-xl">
{{
`width: ${width}px, height: ${height}px, top: ${top}px, left: ${left}px`
}}
</div>
<VResize
:h="200"
:is-active="true"
:w="200"
:x="200"
:y="200"
@dragging="resize"
@resizing="resize"
>
<div class="h-full w-full bg-red-500"></div>
</VResize>
</Page>
</template>