mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-12 03:38:07 +00:00
Fix coding style
This commit is contained in:
parent
dac47d43bf
commit
aab684f8a8
@ -5,31 +5,25 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'no-ssr',
|
name: 'no-ssr',
|
||||||
props: ['placeholder'],
|
props: ['placeholder'],
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
canRender: false
|
canRender: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
this.canRender = true
|
this.canRender = true
|
||||||
},
|
},
|
||||||
render(h) {
|
render (h) {
|
||||||
if (this.canRender) {
|
if (this.canRender) {
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV === 'development' &&
|
process.env.NODE_ENV === 'development' &&
|
||||||
this.$slots.default &&
|
this.$slots.default &&
|
||||||
this.$slots.default.length > 1
|
this.$slots.default.length > 1
|
||||||
) {
|
) {
|
||||||
throw new Error('[vue-no-ssr] You cannot use multiple child components')
|
throw new Error('<no-ssr> You cannot use multiple child components')
|
||||||
}
|
}
|
||||||
return this.$slots.default && this.$slots.default[0]
|
return this.$slots.default && this.$slots.default[0]
|
||||||
}
|
}
|
||||||
return h(
|
return h('div', { class: { 'no-ssr-placeholder': true } }, this.placeholder)
|
||||||
'div',
|
|
||||||
{
|
|
||||||
class: ['no-ssr-placeholder']
|
|
||||||
},
|
|
||||||
this.placeholder
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user