Vue.js的平滑高度过渡 – vue-smooth-height

Vue.js的平滑高度过渡 – vue-smooth-height

插件名称:vue-smooth-height

发布时间:2020年9月21日

插件作者:guanzo

官网 GitHub下载

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>
        `
})
相关插件