<template>
<Affix :offset-bottom="10">
<Button style="text-align:center" type="primary">下一步</Button>
</Affix>
</template>
mounted(){
window.addEventListener("scroll", this.initAffix, true);
}
mehtods:{
initAffix() {
if (!this.affixInit) {
//affix组件有bug,需要触发一次resize事件才能正常
this.affixInit = true;
if (document.createEvent) {
let event = document.createEvent("HTMLEvents");
event.initEvent("resize", true, true);
window.dispatchEvent(event);
} else if (document.createEventObject) {
window.fireEvent("onresize");
}
}
}
}