Skip to content

Commit cd9d01d

Browse files
author
yuukiyao
committed
chore(window): support vue ssr
1 parent d4be10b commit cd9d01d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/tsw/runtime/Window.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ Window.prototype.enable = function() {
2222
global.windowHasDisabled = false;
2323
};
2424

25+
//兼容vue-server-render
26+
Object.defineProperty(Window.prototype, 'navigator', {
27+
get : function(){
28+
if(this.request) {
29+
return {userAgent:this.request.headers['user-agent']};
30+
}else {
31+
return {userAgent:''};
32+
}
33+
}
34+
});

0 commit comments

Comments
 (0)