perf(card): 扩展 插槽 用法, 新增 title 属性
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<img
|
||||
:src="src"
|
||||
:src="href"
|
||||
class="layui-avatar"
|
||||
:class="[
|
||||
radius ? 'layui-avatar-radius' : '',
|
||||
@@ -13,7 +13,7 @@
|
||||
import { defineProps } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
src?: string
|
||||
href?: String
|
||||
radius?: boolean
|
||||
size?: string
|
||||
}>()
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
<template>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<slot name="header" />
|
||||
<div class="layui-card-header" v-if="slot.header || title">
|
||||
<slot name="header" v-if="slot.header" />
|
||||
<span v-else>{{ title }}</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<slot name="body" />
|
||||
<slot name="body" v-if="slot.body" />
|
||||
<slot v-else></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="LayCard" lang="ts"></script>
|
||||
<script setup name="LayCard" lang="ts">
|
||||
import { useSlots } from 'vue'
|
||||
|
||||
const slot = useSlots()
|
||||
|
||||
const props =
|
||||
defineProps<{
|
||||
title?: string
|
||||
}>()
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user