chore(kit): refactor some configs with defu (#1459)

This commit is contained in:
Levi (Nguyễn Lương Huy) 2021-10-26 16:47:30 +07:00 committed by GitHub
parent d2cc9e4bd0
commit 3761b064d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,18 +247,15 @@ export default {
*/
loadingIndicator: {
$resolve: (val, get) => {
if (typeof val === 'string') {
val = { name: val }
}
return {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
name: 'default',
color: get('loading.color') || '#D3D3D3',
color2: '#F5F5F5',
background: (get('manifest') && get('manifest.theme_color')) || 'white',
dev: get('dev'),
loading: get('messages.loading'),
...val
}
loading: get('messages.loading')
})
}
},
@ -272,14 +269,18 @@ export default {
* @see [vue@3 documentation](https://v3.vuejs.org/guide/transitions-enterleave.html)
* @version 2
*/
pageTransition: {
$resolve: val => typeof val === 'string' ? { name: val } : val,
name: 'page',
mode: 'out-in',
appear: { $resolve: (val, get) => (get('render.ssr') === false) ? true : Boolean(val) },
appearClass: 'appear',
appearActiveClass: 'appear-active',
appearToClass: 'appear-to'
pageTransition: {
$resolve: (val, get) => {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
name: 'page',
mode: 'out-in',
appear: get('render.ssr') === false || Boolean(val),
appearClass: 'appear',
appearActiveClass: 'appear-active',
appearToClass: 'appear-to'
})
}
},
/**
@ -293,9 +294,13 @@ export default {
* @version 2
*/
layoutTransition: {
$resolve: val => typeof val === 'string' ? { name: val } : val,
name: 'layout',
mode: 'out-in'
$resolve: val => {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
name: 'layout',
mode: 'out-in'
})
}
},
/**