mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
guard window
This commit is contained in:
parent
8729808625
commit
c9bea3019b
19
index.js
19
index.js
@ -2,15 +2,18 @@ require('./style/index.less');
|
||||
|
||||
// matchMedia polyfill for
|
||||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
||||
window.matchMedia = window.matchMedia || function () {
|
||||
return {
|
||||
matches: false,
|
||||
addListener: function () {
|
||||
},
|
||||
removeListener: function () {
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
const matchMediaPolyfill = function matchMediaPolyfill() {
|
||||
return {
|
||||
matches: false,
|
||||
addListener: function () {
|
||||
},
|
||||
removeListener: function () {
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
window.matchMedia = window.matchMedia || matchMediaPolyfill;
|
||||
}
|
||||
|
||||
const antd = {
|
||||
Affix: require('./components/affix'),
|
||||
|
Loading…
Reference in New Issue
Block a user