Skip to content

Commit

Permalink
chore(window): support vue ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
yuukiyao authored and RobinzZH committed Jun 22, 2018
1 parent 93b30c9 commit 19139f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/tsw/runtime/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ Window.prototype.enable = function() {
global.windowHasDisabled = false;
};

//兼容vue-server-render
Object.defineProperty(Window.prototype, 'navigator', {
get : function(){
if(this.request) {
return {userAgent:this.request.headers['user-agent']};
}else {
return {userAgent:''};
}
}
});

0 comments on commit 19139f9

Please sign in to comment.