一个可移动拖拽的布局组件
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run buildFor detailed explanation on how things work, consult the docs for vue-loader.
npm i drag-component-areaimport DragComponentArea from "drag-component-area";
Vue.use(DragComponentArea);<template>
<drag-component-area ref="content">
<template #item="{ id }">
<div>
{{ id }}
</div>
</template>
</drag-component-area>
</template>
<script>
export default {
methods:{
addComponent(){
if (this.$refs.content) {
for (let i = 0; i < 10; i++) {
this.$refs.content.dragComponentArea.addComponent();
}
}
},
delComponent(id){
if (this.$refs.content) {
this.$refs.content.dragComponentArea.delComponent(id);
}
}
}
}
</script>disableMoveResize禁止移动及放大default: falsemaxCol每行分割成多少列default: 12rowHeight每行高度default: 60
x起始x偏移y起始y偏移w宽度h高度@returns新增的组件实例