Skip to content

Commit

Permalink
feat: Detect if coming from SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Jun 8, 2018
1 parent 96041f1 commit 6f73fac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/mixins/can-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

export default {
data () {
const is = this.$q.platform.is
return {
canRender: is.cordova || is.electron
canRender: !this.$q.platform.is.fromSSR
}
},
mounted () {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ function getPlatform (userAgent) {
else if (window._cordovaNative || window.cordova) {
browser.cordova = true
}

browser.fromSSR = browser.cordova === void 0 &&
browser.electron === void 0 &&
!!document.querySelector('[data-server-rendered]')
}

return browser
Expand Down
2 changes: 1 addition & 1 deletion src/utils/modal-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function (Component, Vue) {

const node = document.createElement('div')
document.body.appendChild(node)

const
ok = data => {
resolve(data)
Expand Down

0 comments on commit 6f73fac

Please sign in to comment.