Skip to content

Commit 85939d1

Browse files
authored
Merge pull request #302 from leezng/dev
release
2 parents 917e207 + a55eb87 commit 85939d1

File tree

6 files changed

+233
-68
lines changed

6 files changed

+233
-68
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ plugins: [
119119
| showDoubleQuotes | Show doublequotes on key | boolean | true |
120120
| virtual | Use virtual scroll | boolean | false |
121121
| height | The height of list when using virtual | number | 400 |
122-
| itemHeight | The height of node when using virtual | number | 20 |
122+
| itemHeight | Fixed row height when using virtual (Estimated row height used before measurement when `dynamicHeight` is true) | number | 20 |
123+
| dynamicHeight | Enable dynamic row heights (measured per row) | boolean | true |
123124
| selectedValue(v-model) | Selected data path | string, array | - |
124125
| rootPath | Root data path | string | `root` |
125126
| nodeSelectable | Defines whether a node supports selection | (node) => boolean | - |
@@ -147,10 +148,10 @@ plugins: [
147148

148149
## Slots
149150

150-
| Slot Name | Description | Parameters |
151+
| Slot Name | Description | Parameters | |
151152
| ----------------- | ------------------- | ---------------------------------------------- | ----- |
152-
| renderNodeKey | render node key | { node, defaultKey } |
153-
| renderNodeValue | render node value | { node, defaultValue } |
153+
| renderNodeKey | render node key | { node, defaultKey } | |
154+
| renderNodeValue | render node value | { node, defaultValue } | |
154155
| renderNodeActions | render node actions | boolean \| ({ node, defaultActions }) => vNode | false |
155156

156157
## Contributors

README.zh_CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
| showDoubleQuotes | 展示 key 名的双引号 | boolean | true |
2424
| virtual | 使用虚拟滚动(大数据量) | boolean | false |
2525
| height | 使用虚拟滚动时,定义总高度 | number | 400 |
26-
| itemHeight | 使用虚拟滚动时,定义节点高度 | number | 20 |
26+
| itemHeight | 使用虚拟滚动时,定义节点高度(可为预估值) | number | 20 |
27+
| dynamicHeight | 使用虚拟滚动时,开启每一行可为动态高度 | boolean | true |
2728
| selectedValue(v-model) | 双向绑定选中的数据路径 | string, array | string, array |
2829
| rootPath | 定义最顶层数据路径 | string | `root` |
2930
| nodeSelectable | 定义哪些数据节点可以被选择 | function(node) | - |

example/VirtualList.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<label>itemHeight</label>
1111
<input v-model="state.itemHeight" type="number" />
1212
</div>
13+
<div>
14+
<label>dynamicHeight</label>
15+
<input v-model="state.dynamicHeight" type="checkbox" />
16+
</div>
1317
<div>
1418
<label>showLine</label>
1519
<input v-model="state.showLine" type="checkbox" />
@@ -49,6 +53,8 @@
4953
:collapsed-node-length="state.collapsedNodeLength"
5054
:virtual="true"
5155
:item-height="+state.itemHeight"
56+
:dynamic-height="state.dynamicHeight"
57+
:estimated-item-height="+state.estimatedItemHeight"
5258
:data="state.data"
5359
:deep="state.deep"
5460
:show-line="state.showLine"
@@ -74,7 +80,7 @@ const defaultData = {
7480
for (let i = 0; i < 10000; i++) {
7581
defaultData.data.push({
7682
news_id: i,
77-
title: 'iPhone X Review: Innovative future with real black technology',
83+
title: `Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.`,
7884
source: 'Netease phone',
7985
});
8086
}
@@ -93,6 +99,7 @@ export default defineComponent({
9399
deep: 3,
94100
collapsedNodeLength: Infinity,
95101
itemHeight: 20,
102+
dynamicHeight: true,
96103
});
97104
98105
const { localDarkMode, toggleLocalDarkMode, globalDarkModeState } = useDarkMode();

example/styles.less

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,16 @@ body {
8282

8383
.example-box {
8484
display: flex;
85+
gap: 60px;
8586

8687
.title {
8788
text-align: center;
8889
}
8990

9091
.block {
91-
width: 50%;
92+
flex: auto;
9293
&:first-child {
93-
padding-right: 30px;
94+
flex: 0 0 450px;
9495
}
9596
}
9697

0 commit comments

Comments
 (0)