From d831caee88256fa7f20d370df4ad2bacf8fbc63c Mon Sep 17 00:00:00 2001 From: yuukiyao Date: Wed, 20 Jun 2018 22:12:27 +0800 Subject: [PATCH] chore(window): support vue ssr --- bin/tsw/runtime/Window.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/tsw/runtime/Window.js b/bin/tsw/runtime/Window.js index d65f8b93..b13738cc 100644 --- a/bin/tsw/runtime/Window.js +++ b/bin/tsw/runtime/Window.js @@ -21,3 +21,13 @@ Window.prototype.enable = function(){ Window.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:''}; + } + } +});