mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
fix(grid): throw error when there's no children
This commit is contained in:
parent
b39a798185
commit
4bbc1e8fa0
@ -169,7 +169,7 @@ export default defineComponent({
|
||||
|
||||
let suffixSpan = 0
|
||||
const maybeSuffixNode =
|
||||
childrenAndRawSpan[childrenAndRawSpan.length - 1].child
|
||||
childrenAndRawSpan[childrenAndRawSpan.length - 1]?.child
|
||||
if (maybeSuffixNode?.props) {
|
||||
const suffixPropValue = maybeSuffixNode.props?.suffix
|
||||
if (suffixPropValue !== undefined && suffixPropValue !== false) {
|
||||
|
@ -4,15 +4,28 @@
|
||||
import { h, createSSRApp } from 'vue'
|
||||
import { renderToString } from '@vue/server-renderer'
|
||||
import { setup } from '@css-render/vue3-ssr'
|
||||
import { NGrid } from '../..'
|
||||
import { NGrid, NGridItem } from '../..'
|
||||
|
||||
describe('SSR', () => {
|
||||
it('works', async () => {
|
||||
it('works 1', async () => {
|
||||
const app = createSSRApp(() => <NGrid />)
|
||||
setup(app)
|
||||
try {
|
||||
await renderToString(app)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
expect(e).not.toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('works 2', async () => {
|
||||
const app = createSSRApp(() => (
|
||||
<NGrid>{{ default: () => <NGridItem /> }}</NGrid>
|
||||
))
|
||||
setup(app)
|
||||
try {
|
||||
await renderToString(app)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
expect(e).not.toBeTruthy()
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user