Browse Source

fix hashchange listener

master
hole-thu 3 years ago
parent
commit
e2505377cd
  1. 4
      src/Title.js

4
src/Title.js

@ -26,7 +26,7 @@ class ControlBar extends PureComponent {
let text = decodeURIComponent(window.location.hash).substr(1); let text = decodeURIComponent(window.location.hash).substr(1);
if (text.lastIndexOf('?') !== -1) if (text.lastIndexOf('?') !== -1)
text = text.substr(0, text.lastIndexOf('?')); // fuck wechat '#param?nsukey=...' text = text.substr(0, text.lastIndexOf('?')); // fuck wechat '#param?nsukey=...'
if (text === '##') return; if (text !== '#' && text !== '##') {
this.setState( this.setState(
{ {
search_text: text, search_text: text,
@ -36,7 +36,9 @@ class ControlBar extends PureComponent {
}, },
); );
} }
}
console.log('add change lis');
window.addEventListener( window.addEventListener(
'hashchange', 'hashchange',
() => { () => {

Loading…
Cancel
Save