Skip to content

Commit d831cae

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

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
@@ -21,3 +21,13 @@ Window.prototype.enable = function(){
2121
Window.windowHasDisabled = false;
2222
};
2323

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

0 commit comments

Comments
 (0)