File tree Expand file tree Collapse file tree 5 files changed +16
-10
lines changed
dev/components/new-layout/pages Expand file tree Collapse file tree 5 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 11<template >
2- <q-page padding class =" bg-yellow page-default-padding" >
2+ <q-page padding class =" page-default-padding" >
33 <q-toggle v-model =" extra" label =" Extra content" />
44 <div v-if =" extra" >
55 <div v-for =" n in 50" >
Original file line number Diff line number Diff line change 11import { QScrollObservable , QResizeObservable , QWindowResizeObservable } from '../observables'
2- import { isSSR } from '../../plugins/platform'
2+ import { onSSR } from '../../plugins/platform'
33
44export default {
55 name : 'QLayout' ,
@@ -17,8 +17,8 @@ export default {
1717 } ,
1818 data ( ) {
1919 return {
20- height : isSSR || this . $q . platform . is . fromSSR ? 0 : window . innerHeight ,
21- width : isSSR || this . $q . platform . is . fromSSR ? 0 : window . innerWidth ,
20+ height : onSSR ? 0 : window . innerHeight ,
21+ width : onSSR ? 0 : window . innerWidth ,
2222
2323 header : {
2424 size : 0 ,
Original file line number Diff line number Diff line change 11import { listenOpts } from '../../utils/event'
2- import { isSSR } from '../../plugins/platform'
2+ import { onSSR , fromSSR } from '../../plugins/platform'
33
44export default {
55 name : 'QWindowResizeObservable' ,
@@ -28,10 +28,10 @@ export default {
2828 }
2929 } ,
3030 created ( ) {
31- this . emit ( isSSR || this . $q . platform . is . fromSSR )
31+ this . emit ( onSSR )
3232 } ,
3333 mounted ( ) {
34- this . $q . platform . is . fromSSR && this . emit ( )
34+ fromSSR && this . emit ( )
3535 window . addEventListener ( 'resize' , this . trigger , listenOpts . passive )
3636 } ,
3737 beforeDestroy ( ) {
Original file line number Diff line number Diff line change 11// using it to manage SSR rendering with best performance
2- import { isSSR } from '../plugins/platform'
2+ import { onSSR } from '../plugins/platform'
33
44export default {
55 data ( ) {
66 return {
7- canRender : ! isSSR && ! this . $q . platform . is . fromSSR
7+ canRender : ! onSSR
88 }
99 } ,
1010 mounted ( ) {
Original file line number Diff line number Diff line change 33/* eslint-disable no-mixed-operators */
44
55export const isSSR = typeof window === 'undefined'
6+ export let fromSSR = false
7+ export let onSSR = isSSR
68
79function getMatch ( userAgent , platformMatch ) {
810 const match = / ( e d g e ) \/ ( [ \w . ] + ) / . exec ( userAgent ) ||
@@ -157,11 +159,15 @@ function getPlatform (userAgent) {
157159 browser . cordova = true
158160 }
159161
160- browser . fromSSR = browser . cordova === void 0 &&
162+ browser . fromSSR = fromSSR = browser . cordova === void 0 &&
161163 browser . electron === void 0 &&
162164 ! ! document . querySelector ( '[data-server-rendered]' )
165+
166+ fromSSR && ( onSSR = true )
163167 }
164168
169+ browser . onSSR = onSSR
170+
165171 return browser
166172}
167173
You can’t perform that action at this time.
0 commit comments