kui-vue 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button/styles/index.less +1 -0
- package/components/checkbox/demo/info.md +5 -8
- package/components/colorPicker/paint.jsx +1 -1
- package/components/components.js +4 -1
- package/components/form/formitem.jsx +1 -1
- package/components/grid/demo/align-white-space.md +30 -0
- package/components/grid/demo/architecture.md +152 -0
- package/components/grid/demo/auto-fill-min-width.md +27 -0
- package/components/grid/demo/basic.md +23 -19
- package/components/grid/demo/bento.md +160 -0
- package/components/grid/demo/breakpoint-fallback.md +28 -0
- package/components/grid/demo/fixed-rows-areas.md +55 -0
- package/components/grid/demo/footer-strategy.md +38 -0
- package/components/grid/demo/hero-section.md +37 -0
- package/components/grid/demo/index.jsx +21 -12
- package/components/grid/demo/info.md +23 -9
- package/components/grid/demo/suffix-display-none.md +27 -0
- package/components/grid/grid.jsx +73 -0
- package/components/grid/gridItem.jsx +55 -0
- package/components/grid/index.js +3 -3
- package/components/grid/index.md +30 -13
- package/components/grid/styles/index.less +6 -67
- package/components/grid/useBreakpoint.js +46 -0
- package/components/icon/demo/search.vue +9 -11
- package/components/input/styles/index.less +3 -0
- package/components/menu/styles/index.less +6 -2
- package/components/rowCol/demo/basic.md +30 -0
- package/components/rowCol/demo/index.jsx +24 -0
- package/components/rowCol/demo/info.md +14 -0
- package/components/rowCol/index.js +4 -0
- package/components/rowCol/index.md +16 -0
- package/components/rowCol/styles/index.less +70 -0
- package/components/statCard/demo/card.md +40 -7
- package/components/statCard/index.md +8 -7
- package/components/statCard/statCard.jsx +6 -2
- package/components/statCard/statNumber.jsx +9 -5
- package/components/statCard/styles/index.less +6 -3
- package/components/styles/index.less +1 -0
- package/components/styles/less-css-var.less +1 -0
- package/components/styles/less-var.less +1 -0
- package/components/table/demo/table-check.md +1 -1
- package/components/tabs/demo/info.md +6 -11
- package/components/tree/demo/info.md +3 -8
- package/components/tree/tree.jsx +1 -1
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +80 -43
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +1 -1
- package/test/i18n@6.x.html +3 -3
- package/types/grid/Grid.d.ts +24 -0
- package/types/grid/GridItem.d.ts +18 -0
- package/types/index.d.ts +12 -8
- package/types/statCard/StatCard.d.ts +1 -0
- package/components/styles/color.less +0 -209
- /package/components/{grid → rowCol}/col.jsx +0 -0
- /package/components/{grid → rowCol}/demo/align.md +0 -0
- /package/components/{grid → rowCol}/demo/fill.md +0 -0
- /package/components/{grid → rowCol}/demo/flex.md +0 -0
- /package/components/{grid → rowCol}/demo/gutter.md +0 -0
- /package/components/{grid → rowCol}/demo/offset.md +0 -0
- /package/components/{grid → rowCol}/row.jsx +0 -0
- /package/types/{grid → rowCol}/Col.d.ts +0 -0
- /package/types/{grid → rowCol}/Row.d.ts +0 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# Checkbox 多选框
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
### Checkbox
|
|
3
|
+
多选框
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## 何时使用
|
|
7
6
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- 在一组可选项中进行多项选择时;
|
|
8
|
+
- 单独使用可以表示两种状态之间的切换,和 switch 类似。区别在于切换 switch 会直接触发状态改变,而 checkbox 一般用于状态标记,需要和提交操作配合。
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</en>
|
|
10
|
+
## 代码演示
|
|
@@ -51,7 +51,7 @@ export default defineComponent({
|
|
|
51
51
|
// 通过hsv 计算xy不能反推
|
|
52
52
|
const [h, s, v] = Color(currentColor.value).hsv().array();
|
|
53
53
|
const x = (s / 100) * width; // s 为 0~100,映射到宽度
|
|
54
|
-
const y = height - (v / 100) * height; // v 为 0~100
|
|
54
|
+
const y = height - (v / 100) * height; // v 为 0~100,映射到高度(从上白到下黑)
|
|
55
55
|
dotPos.x = x - 7;
|
|
56
56
|
dotPos.y = y - 7;
|
|
57
57
|
}
|
package/components/components.js
CHANGED
|
@@ -58,6 +58,9 @@ export { Form, FormItem };
|
|
|
58
58
|
import Flex from "./flex";
|
|
59
59
|
export { Flex };
|
|
60
60
|
|
|
61
|
+
import { Grid, GridItem } from "./grid";
|
|
62
|
+
export { Grid, GridItem };
|
|
63
|
+
|
|
61
64
|
import { KImage, ImageGroup } from "./image";
|
|
62
65
|
export { KImage, ImageGroup };
|
|
63
66
|
|
|
@@ -151,7 +154,7 @@ export { TreeSelect };
|
|
|
151
154
|
import Tag from "./tag";
|
|
152
155
|
export { Tag };
|
|
153
156
|
|
|
154
|
-
import { Row, Col } from "./
|
|
157
|
+
import { Row, Col } from "./rowCol";
|
|
155
158
|
export { Row, Col };
|
|
156
159
|
|
|
157
160
|
import Upload from "./upload";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 复杂数据详情页(对齐与留白)
|
|
3
|
+
描述列表(Descriptions)的效果,但在不同屏幕下自动调整展示密度。
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Align and White Space
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Grid :cols="{ xs: 1, sm: 2, lg: 3, xxl: 4 }" :xGap="32" :yGap="16">
|
|
12
|
+
<GridItem>
|
|
13
|
+
<label>订单编号:</label><span>20240501001</span>
|
|
14
|
+
</GridItem>
|
|
15
|
+
<GridItem>
|
|
16
|
+
<label>状态:</label><span class="status-tag">已发货</span>
|
|
17
|
+
</GridItem>
|
|
18
|
+
|
|
19
|
+
<!-- 在大屏幕上,“地址”占据较长空间,保持视觉平衡 -->
|
|
20
|
+
<GridItem :span="{ xs: 1, lg: 2 }">
|
|
21
|
+
<label>收货地址:</label>
|
|
22
|
+
<span>上海市浦东新区某某路 999 号某某大厦 B 座 12 楼</span>
|
|
23
|
+
</GridItem>
|
|
24
|
+
|
|
25
|
+
<GridItem>
|
|
26
|
+
<label>更新时间:</label><span>2024-05-01 12:00</span>
|
|
27
|
+
</GridItem>
|
|
28
|
+
</Grid>
|
|
29
|
+
</template>
|
|
30
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 布局层级设计 (Architecture)
|
|
3
|
+
- 第一层:Layout 系列 —— 页面大骨架(Header + Sider + Content)。
|
|
4
|
+
|
|
5
|
+
- 第二层:Grid 系列 —— 内容区的主要 2D 布局(统计卡片、Bento 图表矩阵)。
|
|
6
|
+
|
|
7
|
+
- 第三层:Row/Col —— 简单的 1D 比例划分(如底部的两个并排表格)。
|
|
8
|
+
|
|
9
|
+
- 第四层:Flex —— 极细微的内容对齐(卡片标题 + 图标)。
|
|
10
|
+
</cn>
|
|
11
|
+
|
|
12
|
+
<en>
|
|
13
|
+
### Architecture
|
|
14
|
+
</en>
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<template>
|
|
18
|
+
<Layout>
|
|
19
|
+
<Sider class="k-sider">Sider Menu</Sider>
|
|
20
|
+
|
|
21
|
+
<Content class="k-layout-content">
|
|
22
|
+
<Layout>
|
|
23
|
+
<Header class="k-header">
|
|
24
|
+
<div
|
|
25
|
+
:style="{
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
width: '100%',
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
32
|
+
<span>控制台 / 实时监控</span>
|
|
33
|
+
<div :style="{ display: 'flex', gap: '12px' }">
|
|
34
|
+
<Button>刷新数据</Button>
|
|
35
|
+
<Button class="primary">导出报告</Button>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</Header>
|
|
39
|
+
|
|
40
|
+
<Content class="k-main-body">
|
|
41
|
+
<h2 class="section-title">核心指标 (Grid 布局)</h2>
|
|
42
|
+
<Grid
|
|
43
|
+
:cols="{ xs: 2, md: 4, xl: 6 }"
|
|
44
|
+
:x-gap="16"
|
|
45
|
+
:y-gap="16"
|
|
46
|
+
auto-rows="140px"
|
|
47
|
+
:style="{ gridAutoFlow: 'dense', marginBottom: '32px' }"
|
|
48
|
+
>
|
|
49
|
+
<GridItem :span="{ xs: 2, md: 4, xl: 4 }" :row-span="3">
|
|
50
|
+
<div class="chart-card main-chart">实时流量趋势 (大块)</div>
|
|
51
|
+
</GridItem>
|
|
52
|
+
|
|
53
|
+
<GridItem v-for="i in 4" :key="i" :span="{ xs: 1, md: 2, xl: 2 }" :row-span="1">
|
|
54
|
+
<StatCard :title="`📈 指标 ${i}`" :items="[{ value: 1234 + i }]"> </StatCard>
|
|
55
|
+
</GridItem>
|
|
56
|
+
|
|
57
|
+
<GridItem :span="{ xs: 2, md: 2, xl: 2 }" :row-span="2">
|
|
58
|
+
<Card title="动态更新" />
|
|
59
|
+
<div class="chart-card secondary">动态更新</div>
|
|
60
|
+
</GridItem>
|
|
61
|
+
</Grid>
|
|
62
|
+
|
|
63
|
+
<h2 class="section-title">详细列表 (Row/Col 布局)</h2>
|
|
64
|
+
<Row :gutter="16">
|
|
65
|
+
<Col :span="16">
|
|
66
|
+
<div class="table-placeholder">主要数据表格 (占 2/3)</div>
|
|
67
|
+
</Col>
|
|
68
|
+
<Col :span="8">
|
|
69
|
+
<div class="table-placeholder">辅助操作面板 (占 1/3)</div>
|
|
70
|
+
</Col>
|
|
71
|
+
</Row>
|
|
72
|
+
</Content>
|
|
73
|
+
|
|
74
|
+
<Footer class="k-footer">©2026 Grid Layout Pro</Footer>
|
|
75
|
+
</Layout>
|
|
76
|
+
</Content>
|
|
77
|
+
</Layout>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup>
|
|
81
|
+
// 这里引入你之前写的 Grid 和 GridItem
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
.k-layout {
|
|
86
|
+
height: 100vh;
|
|
87
|
+
background: var(--kui-color-bg-container);
|
|
88
|
+
}
|
|
89
|
+
.k-sider {
|
|
90
|
+
width: 200px;
|
|
91
|
+
background: var(--kui-color-bg-layout);
|
|
92
|
+
padding: 20px;
|
|
93
|
+
}
|
|
94
|
+
.k-layout-content {
|
|
95
|
+
overflow-y: auto;
|
|
96
|
+
}
|
|
97
|
+
.k-header {
|
|
98
|
+
height: 64px;
|
|
99
|
+
background: var(--kui-color-bg-1);
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
padding: 10px 24px;
|
|
103
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
|
104
|
+
}
|
|
105
|
+
.k-main-body {
|
|
106
|
+
padding: 24px;
|
|
107
|
+
flex: 1;
|
|
108
|
+
}
|
|
109
|
+
.k-footer {
|
|
110
|
+
text-align: center;
|
|
111
|
+
padding: 24px;
|
|
112
|
+
color: var(--kui-color-text-description);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.section-title {
|
|
116
|
+
font-size: 18px;
|
|
117
|
+
margin-bottom: 16px;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* 卡片样式 */
|
|
122
|
+
.k-stat-card,
|
|
123
|
+
.k-card {
|
|
124
|
+
height: 100%;
|
|
125
|
+
}
|
|
126
|
+
.chart-card,
|
|
127
|
+
.table-placeholder {
|
|
128
|
+
background: var(--kui-color-bg-component);
|
|
129
|
+
height: 100%;
|
|
130
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
|
131
|
+
box-sizing: border-box;
|
|
132
|
+
}
|
|
133
|
+
.main-chart {
|
|
134
|
+
border-radius: 8px;
|
|
135
|
+
padding: 20px;
|
|
136
|
+
background: var(--kui-color-bg-component);
|
|
137
|
+
border: 1px dashed var(--kui-color-primary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.card-value {
|
|
141
|
+
font-size: 24px;
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
margin-top: 12px;
|
|
144
|
+
}
|
|
145
|
+
.table-placeholder {
|
|
146
|
+
border-radius: 8px;
|
|
147
|
+
padding: 20px;
|
|
148
|
+
min-height: 300px;
|
|
149
|
+
border: 1px solid var(--kui-color-border);
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 仪表盘卡片布局 (Auto-fill + Min-Width)
|
|
3
|
+
无需手动设置断点,依靠 `itemMinWidth` 让容器根据宽度自动增减列数。
|
|
4
|
+
|
|
5
|
+
> 当设置了 `itemMinWidth` `时,cols` 参数将失效。这是一种内容驱动的布局方式,非常适合图片画廊或卡片列表,它能保证在容器缩放时,卡片始终保持合适的宽度而不会过于拥挤。
|
|
6
|
+
</cn>
|
|
7
|
+
<en>
|
|
8
|
+
### Auto fill + Min-Width
|
|
9
|
+
</en>
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<template>
|
|
13
|
+
<Grid :itemMinWidth="256" :xGap="16" :yGap="16">
|
|
14
|
+
<GridItem v-for="(x, i) in data" :key="i" class="box"> 卡片 {{ i + 1 }} (最小 256px) </GridItem>
|
|
15
|
+
</Grid>
|
|
16
|
+
</template>
|
|
17
|
+
<script setup>
|
|
18
|
+
import { ref } from "vue";
|
|
19
|
+
const data = ref(Array.from({ length: 7 }));
|
|
20
|
+
</script>
|
|
21
|
+
<style lang="less" scoped>
|
|
22
|
+
.box {
|
|
23
|
+
background: var(--kui-color-bg-3);
|
|
24
|
+
height: 64px;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
```
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
<cn>
|
|
2
2
|
### 基本用法
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
> Grid 的 `offset` 逻辑是基于 `grid-column-start` 的偏移。在 `dense` 填充模式下,`offset` 可能会导致意想不到的“插空”行为。
|
|
5
|
+
|
|
4
6
|
</cn>
|
|
5
7
|
<en>
|
|
8
|
+
|
|
6
9
|
### Basic Usage
|
|
7
|
-
|
|
10
|
+
|
|
8
11
|
</en>
|
|
9
12
|
|
|
10
13
|
```vue
|
|
11
14
|
<template>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
</
|
|
22
|
-
|
|
23
|
-
<Col :span="6">col-6</Col>
|
|
24
|
-
<Col :span="6">col-6</Col>
|
|
25
|
-
<Col :span="6">col-6</Col>
|
|
26
|
-
<Col :span="6">col-6</Col>
|
|
27
|
-
</Row>
|
|
28
|
-
</Space>
|
|
15
|
+
<Grid :cols="{ xs: 1, md: 2, lg: 4 }" :xGap="16" :yGap="16">
|
|
16
|
+
<GridItem :span="2">
|
|
17
|
+
<div class="box">占据 2 列</div>
|
|
18
|
+
</GridItem>
|
|
19
|
+
<GridItem :offset="1">
|
|
20
|
+
<div class="box">偏移 1 列</div>
|
|
21
|
+
</GridItem>
|
|
22
|
+
<GridItem suffix>
|
|
23
|
+
<div class="box">我永远在末尾</div>
|
|
24
|
+
</GridItem>
|
|
25
|
+
</Grid>
|
|
29
26
|
</template>
|
|
27
|
+
<style lang="less">
|
|
28
|
+
.box {
|
|
29
|
+
padding: 8px;
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
background: var(--kui-color-bg-3);
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
30
34
|
```
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 图片画廊 / 瀑布流(Bento Grid 风格)
|
|
3
|
+
非对称布局
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Bento Grid
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
Code snippet
|
|
11
|
+
<template>
|
|
12
|
+
<div class="demo-container">
|
|
13
|
+
<h1 class="demo-title">技术规格矩阵</h1>
|
|
14
|
+
|
|
15
|
+
<Grid
|
|
16
|
+
:cols="{ xs: 2, md: 6, xl: 8 }"
|
|
17
|
+
:x-gap="20"
|
|
18
|
+
:y-gap="20"
|
|
19
|
+
auto-rows="120px"
|
|
20
|
+
:style="{ gridAutoFlow: 'dense' }"
|
|
21
|
+
>
|
|
22
|
+
<GridItem v-for="item in features" :key="item.id" :span="item.span" :row-span="item.rowSpan">
|
|
23
|
+
<div
|
|
24
|
+
class="bento-card"
|
|
25
|
+
:style="{
|
|
26
|
+
backgroundColor: item.color,
|
|
27
|
+
color: item.textColor || '#333',
|
|
28
|
+
border: item.border || 'none',
|
|
29
|
+
}"
|
|
30
|
+
>
|
|
31
|
+
<div class="card-content">
|
|
32
|
+
<h3 class="card-title">{{ item.title }}</h3>
|
|
33
|
+
<p class="card-desc">{{ item.desc }}</p>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</GridItem>
|
|
37
|
+
|
|
38
|
+
<GridItem suffix :span="{ xs: 2, md: 3, xl: 2 }">
|
|
39
|
+
<div class="bento-cta">
|
|
40
|
+
<span>了解更多参数 →</span>
|
|
41
|
+
</div>
|
|
42
|
+
</GridItem>
|
|
43
|
+
</Grid>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
const features = [
|
|
49
|
+
{
|
|
50
|
+
id: 1,
|
|
51
|
+
title: "自研芯片 M3 Max",
|
|
52
|
+
desc: "极致算力,从容应对专业级工作流。",
|
|
53
|
+
span: { xs: 2, md: 3, xl: 4 }, // 桌面占一半宽
|
|
54
|
+
rowSpan: 3, // 高度占 3 个单位
|
|
55
|
+
color: "var(--kui-color-bg-4)",
|
|
56
|
+
textColor: "#fff",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 2,
|
|
60
|
+
title: "超长续航",
|
|
61
|
+
desc: "长达 22 小时视频播放。",
|
|
62
|
+
span: { xs: 1, md: 3, xl: 2 },
|
|
63
|
+
rowSpan: 2,
|
|
64
|
+
color: "#f5f5f7",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 3,
|
|
68
|
+
title: "5G 超高速",
|
|
69
|
+
desc: "随时随地,畅享疾速。",
|
|
70
|
+
span: { xs: 1, md: 3, xl: 2 },
|
|
71
|
+
rowSpan: 1,
|
|
72
|
+
color: "#e8e8ed",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 4,
|
|
76
|
+
title: "Retina 显示屏",
|
|
77
|
+
desc: "绚丽色彩,纤毫毕现。",
|
|
78
|
+
span: { xs: 2, md: 3, xl: 4 },
|
|
79
|
+
rowSpan: 2,
|
|
80
|
+
color: "#fff",
|
|
81
|
+
border: "1px solid var(--kui-color-border)",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 5,
|
|
85
|
+
title: "隐私保护",
|
|
86
|
+
desc: "你的数据,由你掌控。",
|
|
87
|
+
span: { xs: 1, md: 3, xl: 2 },
|
|
88
|
+
rowSpan: 2,
|
|
89
|
+
color: "#f2f2f2",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 6,
|
|
93
|
+
title: "多设备协作",
|
|
94
|
+
desc: "无缝衔接,效率翻倍。",
|
|
95
|
+
span: { xs: 1, md: 3, xl: 2 },
|
|
96
|
+
rowSpan: 1,
|
|
97
|
+
color: "#fafafa",
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style scoped>
|
|
103
|
+
.demo-container {
|
|
104
|
+
padding: 40px 20px;
|
|
105
|
+
max-width: 1200px;
|
|
106
|
+
margin: 0 auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.demo-title {
|
|
110
|
+
margin-bottom: 32px;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
font-size: 2rem;
|
|
113
|
+
color: var(--kui-color-text);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.bento-card {
|
|
117
|
+
height: 100%;
|
|
118
|
+
border-radius: 24px;
|
|
119
|
+
padding: 32px;
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
justify-content: flex-end;
|
|
124
|
+
transition: transform 0.2s ease-in-out;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.bento-card:hover {
|
|
129
|
+
transform: scale(0.99);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.card-title {
|
|
133
|
+
font-size: 1.5rem;
|
|
134
|
+
margin: 0 0 8px 0;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.card-desc {
|
|
139
|
+
font-size: 1rem;
|
|
140
|
+
opacity: 0.7;
|
|
141
|
+
margin: 0;
|
|
142
|
+
line-height: 1.4;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.bento-cta {
|
|
146
|
+
background: var(--kui-color-primary);
|
|
147
|
+
color: #fff;
|
|
148
|
+
border-radius: 24px;
|
|
149
|
+
height: 100%;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
font-size: 1.1rem;
|
|
154
|
+
font-weight: 500;
|
|
155
|
+
padding: 32px;
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
160
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 复杂表单响应式 (Breakpoint Fallback)
|
|
3
|
+
断点的向上/向下寻找逻辑。例如:定义了 md 没定义 lg,系统是否能正确应用 md 的值。
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Breakpoint Fallback
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Grid :cols="{ xs: 1, md: 4, xl: 6 }" :xGap="20" :yGap="20">
|
|
12
|
+
<!-- 手机占满, 平板占2格, 电脑占1格 -->
|
|
13
|
+
<GridItem :span="{ xs: 1, md: 2, xl: 1 }">
|
|
14
|
+
<Input placeholder="项目名称" />
|
|
15
|
+
</GridItem>
|
|
16
|
+
|
|
17
|
+
<!-- 测试:未定义 lg,应回退到 md 的 2 格 -->
|
|
18
|
+
<GridItem :span="{ xs: 1, md: 2 }">
|
|
19
|
+
<Input placeholder="负责人 (LG尺寸应沿用MD的2格)" />
|
|
20
|
+
</GridItem>
|
|
21
|
+
|
|
22
|
+
<!-- Offset 测试:在桌面端留空一格 -->
|
|
23
|
+
<GridItem :span="{ md: 2 }" :offset="{ md: 1 }">
|
|
24
|
+
<Input placeholder="备注 (左侧偏移1格)" />
|
|
25
|
+
</GridItem>
|
|
26
|
+
</Grid>
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 圣杯布局/管理后台 (Fixed Rows & Areas)
|
|
3
|
+
`rows` 和 `rowSpan` 的垂直控制力。</cn>
|
|
4
|
+
<en>
|
|
5
|
+
### Fixed Rows & Areas
|
|
6
|
+
</en>
|
|
7
|
+
|
|
8
|
+
```vue
|
|
9
|
+
<template>
|
|
10
|
+
<Grid :cols="4" rows="auto 1fr auto" class="demo-fixed-rows-areas">
|
|
11
|
+
<!-- Header -->
|
|
12
|
+
<GridItem :span="4" class="demo-grid-header"> Header (100% Width) </GridItem>
|
|
13
|
+
|
|
14
|
+
<!-- Sidebar: 跨 1 行 -->
|
|
15
|
+
<GridItem :span="1" row:span="1" class="demo-grid-sidebar"> Menu </GridItem>
|
|
16
|
+
|
|
17
|
+
<!-- Main: 占 3 列 -->
|
|
18
|
+
<GridItem :span="3" class="demo-grid-main"> Main Content (Auto Height) </GridItem>
|
|
19
|
+
|
|
20
|
+
<!-- Footer: 强制置底 -->
|
|
21
|
+
<GridItem :span="4" class="demo-grid-footer"> Footer </GridItem>
|
|
22
|
+
</Grid>
|
|
23
|
+
</template>
|
|
24
|
+
<style lang="less" scoped>
|
|
25
|
+
.demo-fixed-rows-areas {
|
|
26
|
+
height: 500px;
|
|
27
|
+
border: 1px solid var(--kui-color-border);
|
|
28
|
+
border-radius: 12px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
.k-grid-item {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
.demo-grid-header {
|
|
36
|
+
height: 50px;
|
|
37
|
+
background: var(--kui-color-bg-3);
|
|
38
|
+
padding: 8px;
|
|
39
|
+
}
|
|
40
|
+
.demo-grid-sidebar {
|
|
41
|
+
padding: 8px;
|
|
42
|
+
background: var(--kui-color-bg-4);
|
|
43
|
+
}
|
|
44
|
+
.demo-grid-main {
|
|
45
|
+
padding: 8px;
|
|
46
|
+
background: var(--kui-color-bg-2);
|
|
47
|
+
}
|
|
48
|
+
.demo-grid-footer {
|
|
49
|
+
background: var(--kui-color-bg-3);
|
|
50
|
+
padding: 8px;
|
|
51
|
+
height: 50px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 响应式底栏 / 菜单(Footer Strategy)
|
|
3
|
+
从“多列垂直排列”到“单列折叠”的极致压缩。
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Footer Strategy
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Grid :cols="{ xs: 1, sm: 2, md: 5 }" :yGap="30">
|
|
12
|
+
<GridItem :span="{ xs: 1, md: 2 }">
|
|
13
|
+
<h3>公司品牌 Logo</h3>
|
|
14
|
+
<p>致力于提供全球领先的 Grid 解决方案。</p>
|
|
15
|
+
</GridItem>
|
|
16
|
+
|
|
17
|
+
<!-- 下面三个在 md 以上各占 1 列,在 sm 占 1/2,在 xs 占满 -->
|
|
18
|
+
<GridItem>
|
|
19
|
+
<h4>产品</h4>
|
|
20
|
+
<ul>
|
|
21
|
+
<li>功能 1</li>
|
|
22
|
+
<li>功能 2</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</GridItem>
|
|
25
|
+
<GridItem>
|
|
26
|
+
<h4>支持</h4>
|
|
27
|
+
<ul>
|
|
28
|
+
<li>文档</li>
|
|
29
|
+
<li>社区</li>
|
|
30
|
+
</ul>
|
|
31
|
+
</GridItem>
|
|
32
|
+
<GridItem>
|
|
33
|
+
<h4>联系我们</h4>
|
|
34
|
+
<div class="social-icons">...</div>
|
|
35
|
+
</GridItem>
|
|
36
|
+
</Grid>
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### Hero Section 叠加布局(Layering)
|
|
3
|
+
`grid-column-start` 和 `grid-row-start` 的重叠能力,文字浮动在图片某处
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Hero Section
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Grid :cols="12" :rows="8" :style="{ height: '400px', background: 'var(--kui-color-bg-5)' }">
|
|
12
|
+
<!-- 背景图片:占据全部格子 -->
|
|
13
|
+
<GridItem :span="12" :rowSpan="8" :style="{ gridColumnStart: 1, gridRowStart: 1 }">
|
|
14
|
+
<img
|
|
15
|
+
src="https://cdn.chuchur.com/upload/2017/kui-for-vue.jpg"
|
|
16
|
+
:style="{ width: '100%', height: '100%', objectFit: 'cover' }"
|
|
17
|
+
/>
|
|
18
|
+
</GridItem>
|
|
19
|
+
|
|
20
|
+
<!-- 文字内容:浮动在图片正中心,占据中间 6 列和中间 4 行 -->
|
|
21
|
+
<GridItem
|
|
22
|
+
:span="{ xs: 10, md: 6 }"
|
|
23
|
+
:rowSpan="4"
|
|
24
|
+
:style="{
|
|
25
|
+
gridColumnStart: 'calc(50% - 3)',
|
|
26
|
+
gridRowStart: 3,
|
|
27
|
+
background: 'var(--kui-color-bg-3)',
|
|
28
|
+
zIndex: 1,
|
|
29
|
+
padding: '20px',
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
32
|
+
<h1>商用级广告语</h1>
|
|
33
|
+
<p>Grid 布局让叠加效果变得简单,无需大量 absolute 定位。</p>
|
|
34
|
+
</GridItem>
|
|
35
|
+
</Grid>
|
|
36
|
+
</template>
|
|
37
|
+
```
|