Fix coding style

This commit is contained in:
Daniel Post 2017-11-21 12:15:11 +00:00 committed by GitHub
parent dac47d43bf
commit aab684f8a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,31 +5,25 @@
export default {
name: 'no-ssr',
props: ['placeholder'],
data() {
data () {
return {
canRender: false
}
},
mounted() {
mounted () {
this.canRender = true
},
render(h) {
render (h) {
if (this.canRender) {
if (
process.env.NODE_ENV === 'development' &&
this.$slots.default &&
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 h(
'div',
{
class: ['no-ssr-placeholder']
},
this.placeholder
)
return h('div', { class: { 'no-ssr-placeholder': true } }, this.placeholder)
}
}