chore: use isArray to keep the code consistency

This commit is contained in:
edison 2021-04-12 18:31:11 +08:00 committed by GitHub
parent 870f2a7ba3
commit 7db8c9c19a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import { ComponentInternalInstance, Slots } from 'vue'
import { Props, PushFn, renderVNodeChildren, SSRBufferItem } from '../render'
import { isArray } from '@vue/shared'
export type SSRSlots = Record<string, SSRSlot>
export type SSRSlot = (
@ -32,7 +33,7 @@ export function ssrRenderSlot(
parentComponent,
slotScopeId ? ' ' + slotScopeId : ''
)
if (Array.isArray(ret)) {
if (isArray(ret)) {
// normal slot
renderVNodeChildren(push, ret, parentComponent, slotScopeId)
} else {

View File

@ -1,4 +1,4 @@
import { looseEqual, looseIndexOf } from '@vue/shared'
import { looseEqual, looseIndexOf, isArray } from '@vue/shared'
import { ssrRenderAttr } from './ssrRenderAttrs'
export const ssrLooseEqual = looseEqual as (a: unknown, b: unknown) => boolean
@ -17,7 +17,7 @@ export function ssrRenderDynamicModel(
case 'radio':
return looseEqual(model, value) ? ' checked' : ''
case 'checkbox':
return (Array.isArray(model)
return (isArray(model)
? ssrLooseContain(model, value)
: model)
? ' checked'
@ -38,7 +38,7 @@ export function ssrGetDynamicModelProps(
case 'radio':
return looseEqual(model, value) ? { checked: true } : null
case 'checkbox':
return (Array.isArray(model)
return (isArray(model)
? ssrLooseContain(model, value)
: model)
? { checked: true }