[新增] card 组件
This commit is contained in:
parent
81785521f6
commit
80952a2172
26
docs/docs/zh-CN/components/cards.md
Normal file
26
docs/docs/zh-CN/components/cards.md
Normal file
@ -0,0 +1,26 @@
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-card>
|
||||
<template v-slot:header>
|
||||
标题
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
内容
|
||||
</template>
|
||||
</lay-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
return {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
:::
|
@ -11,6 +11,7 @@
|
||||
<li><router-link to="/zh-CN/components/button">按钮</router-link></li>
|
||||
<li><router-link to="/zh-CN/components/icon">图标</router-link></li>
|
||||
<li><router-link to="/zh-CN/components/panel">面板</router-link></li>
|
||||
<li><router-link to="/zh-CN/components/card">卡片</router-link></li>
|
||||
</ul>
|
||||
</lay-side>
|
||||
<lay-body>
|
||||
|
@ -5,9 +5,8 @@ import {
|
||||
Router,
|
||||
} from 'vue-router'
|
||||
import zhCN from './zh-CN'
|
||||
import type { IRouteRecordRaw } from '/@src/index'
|
||||
|
||||
const routes: IRouteRecordRaw[] = [...zhCN]
|
||||
const routes = [...zhCN]
|
||||
|
||||
export function createRouter(): Router {
|
||||
const baseUrl = import.meta.env.BASE_URL
|
||||
|
@ -32,6 +32,10 @@ const zhCN = [
|
||||
path: '/zh-CN/components/panel',
|
||||
component: () => import('../../docs/zh-CN/components/panel.md'),
|
||||
meta: { title: '面板' },
|
||||
},{
|
||||
path: '/zh-CN/components/card',
|
||||
component: () => import('../../docs/zh-CN/components/cards.md'),
|
||||
meta: { title: '卡片' },
|
||||
}
|
||||
],
|
||||
},
|
||||
|
@ -5,6 +5,7 @@ import "./css/layui.css";
|
||||
import LayRadio from './module/radio/index'
|
||||
import LayButton from './module/button/index'
|
||||
import LayIcon from './module/icon/index'
|
||||
import LayCard from './module/card/index'
|
||||
import LayLayout from "./module/layout/index"
|
||||
import LaySide from "./module/side/index"
|
||||
import LayBody from "./module/body/index"
|
||||
@ -23,7 +24,8 @@ const components: Record<string, IDefineComponent> = {
|
||||
LayBody,
|
||||
LayFooter,
|
||||
LayLogo,
|
||||
LayPanel
|
||||
LayPanel,
|
||||
LayCard
|
||||
}
|
||||
|
||||
const install = (app: App, options?: InstallOptions): void => {
|
||||
@ -47,6 +49,7 @@ export {
|
||||
LayFooter,
|
||||
LayLogo,
|
||||
LayPanel,
|
||||
LayCard,
|
||||
install,
|
||||
}
|
||||
|
||||
|
9
src/module/card/index.ts
Normal file
9
src/module/card/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type { App } from 'vue'
|
||||
import Component from './index.vue'
|
||||
import type { IDefineComponent } from '../type/index'
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || 'LayCard ', Component)
|
||||
}
|
||||
|
||||
export default Component as IDefineComponent
|
14
src/module/card/index.vue
Normal file
14
src/module/card/index.vue
Normal file
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<slot name="body"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="LayCard" lang="ts">
|
||||
|
||||
</script>
|
@ -1,6 +1,6 @@
|
||||
import type { App } from 'vue'
|
||||
import Component from './index.vue'
|
||||
import type { IDefineComponent } from '../../type/index'
|
||||
import type { IDefineComponent } from '../type/index'
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || 'LayIcon', Component)
|
||||
|
@ -3,7 +3,7 @@ import Component from './index.vue'
|
||||
import type { IDefineComponent } from '../type/index'
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || 'LayLogo', Component)
|
||||
app.component(Component.name || 'LayPanel', Component)
|
||||
}
|
||||
|
||||
export default Component as IDefineComponent
|
||||
|
Loading…
Reference in New Issue
Block a user