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 { createNamespace, isDef } from '../utils';
|
||||||
import { doubleRaf } from '../utils/dom/raf';
|
import { doubleRaf } from '../utils/dom/raf';
|
||||||
|
import { BindEventMixin } from '../mixins/bind-event';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('notice-bar');
|
const [createComponent, bem] = createNamespace('notice-bar');
|
||||||
|
|
||||||
export default createComponent({
|
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: {
|
props: {
|
||||||
text: String,
|
text: String,
|
||||||
mode: String,
|
mode: String,
|
||||||
@ -83,7 +92,8 @@ export default createComponent({
|
|||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
setTimeout(() => {
|
clearTimeout(this.startTimer);
|
||||||
|
this.startTimer = setTimeout(() => {
|
||||||
const { wrap, content } = this.$refs;
|
const { wrap, content } = this.$refs;
|
||||||
if (!wrap || !content || this.scrollable === false) {
|
if (!wrap || !content || this.scrollable === false) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user