npm i pinch-zoom-js --save
import 导入
import PinchZoom from 'pinch-zoom-js'
动态设置高度
<div id="father" :style="{ height: height }">
<div id="vhtml" v-html="content" />
</div>
js方法
data() {
return {
height: '500px'
}
},
mounted() {
this.$nextTick(() => {
this.reSetSize()
setTimeout(() => {
const el = document.getElementById('vhtml')
new PinchZoom(el, {})
}, 1000)
})
},
methods: {
// 获取宽高
reSetSize() {
this.$nextTick(() => {
const height = window.innerHeight || document.documentElement.clientHeight
this.height = height - 46 + 'px'
console.log(this.height)
})
}
}
标记文本
遇到的坑:
1、导入
2、获取元素
3、动态设置高度的问题