引入 :import uploadImg from "@/components/uploadImg.vue";
components: {
uploadImg,
},
使用: <uploadImg><uploadImg/>
cropperjs封装成组件时需要动态修改截图的比例出现问题的解决方案
通过给组件添加key动态生成新的组件
<uploadImg :key="menuKey"><uploadImg/>
通过监听某个元素动态修改 控制截图比例和++menuKey
watch: {
baseHeight: function (newval) {
++this.menuKey;
},
},