Skip to content

Commit dd23487

Browse files
committed
feat: SSR work on components
1 parent dd1d4a9 commit dd23487

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

src/components/ajax-bar/QAjaxBar.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,10 @@ export default {
190190
highjackAjax(this.start, this.stop)
191191
},
192192
beforeDestroy () {
193-
if (!isSSR) {
194-
clearTimeout(this.timer)
195-
restoreAjax()
196-
}
193+
clearTimeout(this.timer)
194+
restoreAjax()
197195
},
198196
render (h) {
199-
if (isSSR) { return }
200-
201197
return h('div', {
202198
staticClass: 'q-loading-bar shadow-4',
203199
'class': this.classes,

src/components/parallax/QParallax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default {
110110
])
111111
])
112112
},
113-
created () {
113+
beforeMount () {
114114
this.__setPos = frameDebounce(this.__setPos)
115115
},
116116
mounted () {

src/components/tooltip/QTooltip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default {
104104
])
105105
])
106106
},
107-
created () {
107+
beforeMount () {
108108
this.__debouncedUpdatePosition = debounce(() => {
109109
this.__updatePosition()
110110
}, 70)

src/mixins/fullscreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
this.inFullscreen = false
5151
}
5252
},
53-
created () {
53+
beforeMount () {
5454
this.fullscreenFillerNode = document.createElement('span')
5555
},
5656
beforeDestroy () {

src/plugins/dialog.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { QDialog } from '../components/dialog'
2-
import { isSSR } from './platform'
32
import modalFn from '../utils/modal-fn'
43

54
export default {
@@ -8,8 +7,6 @@ export default {
87
if (this.__installed) { return }
98
this.__installed = true
109

11-
this.create = $q.dialog = isSSR
12-
? () => new Promise()
13-
: modalFn(QDialog, Vue)
10+
this.create = $q.dialog = modalFn(QDialog, Vue)
1411
}
1512
}

src/utils/modal-fn.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import { isSSR } from '../plugins/platform'
2+
13
export default function (Component, Vue) {
24
return props => {
3-
const node = document.createElement('div')
4-
document.body.appendChild(node)
5-
65
return new Promise((resolve, reject) => {
6+
if (isSSR) { return }
7+
8+
const node = document.createElement('div')
9+
document.body.appendChild(node)
10+
711
const vm = new Vue({
812
el: node,
913
data () {

0 commit comments

Comments
 (0)