mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(NoticeBar): fix cache issues with forwards and back history in safari (#7167)
This commit is contained in:
parent
61106313dc
commit
60ce34d4a7
@ -1,10 +1,19 @@
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { doubleRaf } from '../utils/dom/raf';
|
||||
import { BindEventMixin } from '../mixins/bind-event';
|
||||
import Icon from '../icon';
|
||||
|
||||
const [createComponent, bem] = createNamespace('notice-bar');
|
||||
|
||||
export default createComponent({
|
||||
mixins: [
|
||||
BindEventMixin(function (bind) {
|
||||
// fix cache issues with forwards and back history in safari
|
||||
// see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
|
||||
bind(window, 'pageshow', this.start);
|
||||
}),
|
||||
],
|
||||
|
||||
props: {
|
||||
text: String,
|
||||
mode: String,
|
||||
@ -83,7 +92,8 @@ export default createComponent({
|
||||
|
||||
this.reset();
|
||||
|
||||
setTimeout(() => {
|
||||
clearTimeout(this.startTimer);
|
||||
this.startTimer = setTimeout(() => {
|
||||
const { wrap, content } = this.$refs;
|
||||
if (!wrap || !content || this.scrollable === false) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user