下载:yarn add vue-drag-resize
<template>
<Vuedragresize
:w="width"
:h="height"
:isActive=true
:y="top"
:x="left"
:parentLimitation="true"
:parentH="parentH"
:parentW="parentW"
@resizing="resize"
@resizestop="dragResizeStop"
@dragstop="dragResizeStop"
@activated="activateEv"
>
<Input
ref="inputVals"
:autosize="{ minRows: 2, maxRows: 5 }"
type="textarea"
v-model="inputValue"
@on-change="handClick"
/></Vuedragresize>
</template>
<script>
import Vuedragresize from "vue-drag-resize";
export default {
components: {
Vuedragresize,
},
data() {
return {
option: {
inputValue: "",
},
width: 300,
height: 300,
myChart: "",
top: 0,
left: 300,
parentH: 1500,
parentW: 1300,
};
},
created() {
},
computed: {},
methods: {
resize(newRect) {
this.width = newRect.width;
this.height = newRect.height;
},
dragResizeStop(newRect) {
this.$emit("editPositionSize", newRect);
},
handClick() {
this.$emit("inputValue", this.inputValue);
},
activateEv() {
this.$refs["inputVals"].focus();
},
},
};
</script>
<style lang="less" scoped></style>