Skip to content

Commit

Permalink
feat: integrate vuedraggable
Browse files Browse the repository at this point in the history
  • Loading branch information
flingyp committed Jun 27, 2023
1 parent 584aff5 commit f048730
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"vue-i18n": "^9.2.2",
"vue-router": "^4.2.2",
"vue3-photo-preview": "^0.3.0",
"vuedraggable": "^4.1.0",
"xgplayer": "^2.32.3",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz"
},
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"commonXGPlayer": "西瓜播放器",
"commonTable": "基础表格",
"commonImagePreview": "图片预览",
"commonDraggable": "拖拽组件",
"commonGuide": "引导页",
"commonClipboard": "剪贴板",
"commonDocs": "文档",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"commonTable": "Basic Table",
"commonImagePreview": "Image Preview",
"commonClipboard": "Clipboard",
"commonDraggable": "Draggable",
"commonGuide": "Introductory Page",
"commonDocs": "Docs",
"commonMultilevelMenu": "Multilevel Menu",
Expand Down
1 change: 1 addition & 0 deletions src/locales/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"commonXGPlayer": "수박 플레이어",
"commonTable": "기본 테이블",
"commonImagePreview": "이미지 미리보기",
"commonDraggable": "구성 요소 드래그",
"commonGuide": "소개 페이지",
"commonClipboard": "클립보드",
"commonDocs": "문서",
Expand Down
9 changes: 9 additions & 0 deletions src/router/modules/constant-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ export const CONSTANT_ROUTES: VAdmireRoute[] = [
icon: 'mdi:clipboard-text',
},
},
{
path: 'draggable',
name: 'Feature_Draggable',
component: '~/views/features/Draggable.vue',
meta: {
text: '$t("route.commonDraggable")',
icon: 'mdi:drag-variant',
},
},
{
path: '',
name: 'GuideIndex',
Expand Down
60 changes: 60 additions & 0 deletions src/views/features/Draggable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script setup lang="ts">
import Draggable from 'vuedraggable'
const drag = ref(false)
const draggableList = ref([
{
id: 1,
label: 'Item 1',
},
{
id: 2,
label: 'Item 2',
},
{
id: 3,
label: 'Item 3',
},
{
id: 4,
label: 'Item 4',
},
{
id: 5,
label: 'Item 5',
},
{
id: 6,
label: 'Item 6',
},
{
id: 7,
label: 'Item 7',
},
])
const dragStart = () => {
drag.value = true
}
const dragEnd = () => {
drag.value = false
console.log('New draggableList->>>', draggableList.value)
}
</script>

<template>
<div>
<Draggable
v-model="draggableList"
item-key="id"
group="people"
@start="dragStart"
@end="dragEnd"
>
<template #item="{element}">
<div class="p-4 mb-4 last:mb-0 cursor-grab rounded border border-vBorderLight dark:border-vBorderDark">
{{ element.id }} - {{ element.label }}
</div>
</template>
</Draggable>
</div>
</template>

0 comments on commit f048730

Please sign in to comment.