Vue平滑高度组件响应于数据更改而转换容器元素的高度。
模块:
<template>
<div>
<div ref="container"></div>
</div>
</template>
<script>
import smoothHeight from 'vue-smooth-height';
export default {
mixins:[smoothHeight],
mounted(){
this.$smoothElement({
el: this.$refs.container,
})
},
}
</script>
浏览器:
通过全局变量可以使用mixin SmoothHeight
Vue.component('myComponent', {
mixins:[SmoothHeight],
mounted(){
this.$smoothElement({
el: this.$refs.container,
})
},
template:
`
<div>
<div ref="container"></div>
</div>
`
})