Skip to content

Commit 87fbbe6

Browse files
committed
Update desc
1 parent fd827da commit 87fbbe6

File tree

10 files changed

+46
-16
lines changed

10 files changed

+46
-16
lines changed

example/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ body {
4545
}
4646
4747
code {
48-
background-color: gold !important;
48+
background-color: pink !important;
4949
}
5050
</style>

example/src/views/dynamic-size/Code.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
const html =
1010
`
1111
<virtual-list class="list"
12-
:size="80" // Just pass a estimate size.
12+
:size="80" // just assign a estimate value.
1313
:keeps="30"
1414
:data-key="'id'"
1515
:data-sources="items"
@@ -23,7 +23,7 @@ import Item from './Item'
2323
const items = [
2424
{
2525
id: 'unique-id-xxx',
26-
...item props
26+
...
2727
},
2828
....
2929
]

example/src/views/dynamic-size/Main.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="example">
33
<github-corner />
4-
<introduction description="The size of each item is dynamic." />
4+
<introduction description="The size of each item is dynamic, you don't have to care about size, it will calculate automatic, but you have to make sure that there's an unique id for every array data." />
55

66
<div class="example-content">
77
<tab v-on:tab-change="onTabChange" />

example/src/views/fixed-size/Code.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
const html =
1010
`
1111
<virtual-list class="list"
12-
:size="60"
12+
:size="60" // just assign a estimate value.
1313
:keeps="30"
1414
:data-key="'id'"
1515
:data-sources="items"
@@ -23,7 +23,7 @@ import Item from './Item'
2323
const items = [
2424
{
2525
id: 'unique-id-xxx',
26-
...item props
26+
...
2727
},
2828
....
2929
]

example/src/views/horizontal/Code.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
const html =
1010
`
1111
<virtual-list class="list-horizontal"
12-
:size="110"
12+
:size="110" // just assign a estimate value.
1313
:keeps="30"
14-
:direction="'horizontal'"
14+
:direction="'horizontal'" // make scroll direction in horizontal.
1515
:wrap-class="'wrapper'"
1616
:item-class="'list-item-horizontal'"
17-
1817
:data-key="'id'"
1918
:data-sources="items"
2019
:data-component="itemComponent"

example/src/views/horizontal/Main.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="example">
33
<github-corner />
4-
<introduction description="The size of each item is dynamic." />
4+
<introduction description="Set <code>direction</code> as <code>horizontal</code>, and also can use <code>wrap-class</code>, <code>item-class</code> to help you layout items in horizontal." />
55

66
<div class="example-content">
77
<tab v-on:tab-change="onTabChange" />

example/src/views/infinite-loading/Code.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ const html =
1414
:data-key="'id'"
1515
:data-sources="items"
1616
:data-component="itemComponent"
17-
v-on:tobottom="onScrollToBottom"
18-
/>
17+
v-on:tolower="onScrollToBottom"
18+
>
19+
<div slot="footer" class="loading-spinner">Loading ...</div>
20+
</virtual-list>
1921
`
2022
2123
const js =
2224
`
2325
export default {
2426
data () {
2527
return {
26-
items: getPageData(pageSize, 0),
2728
itemComponent: Item,
29+
items: getPageData(pageSize, 0)
2830
}
2931
},
3032

example/src/views/infinite-loading/Main.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="example">
33
<github-corner />
4-
<introduction description="The size of each item is dynamic." />
4+
<introduction description="Use <code>v-on:tobottom</code> to listen scroll reach bottom, add a footer slot as loading, then append next parts data into <code>data-sources</code> array." />
55

66
<div class="example-content">
77
<tab v-on:tab-change="onTabChange" />

example/src/views/keep-state/Code.vue

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,46 @@
22
<div>
33
<div class="title">This example source code please refer to:</div>
44
<p><a v-bind:href="href" target="_blank">{{ href }}</a></p>
5+
6+
<div>Here provide a common child-to-parent dispatch mixins code:</div>
7+
<code-high-light type="js" :code="mixin" />
58
</div>
69
</template>
710

811
<script>
912
import getCodeUrl from '../../common/get-code-url'
1013
14+
const mixinCode =
15+
`
16+
export default {
17+
methods: {
18+
dispatch (componentName, eventName, ...rest) {
19+
let parent = this.$parent || this.$root
20+
let name = parent.$options.name
21+
22+
while (parent && (!name || name !== componentName)) {
23+
parent = parent.$parent
24+
if (parent) {
25+
name = parent.$options.name
26+
}
27+
}
28+
29+
if (parent) {
30+
parent.$emit.apply(parent, [eventName].concat(rest))
31+
}
32+
}
33+
}
34+
}
35+
`
36+
1137
export default {
1238
name: 'keep-state-code',
1339
1440
data () {
15-
return { href: '' }
41+
return {
42+
href: '',
43+
mixin: mixinCode
44+
}
1645
},
1746
1847
mounted () {

example/src/views/keep-state/Main.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="example">
33
<github-corner />
4-
<introduction description="The size of each item is equal." />
4+
<introduction description="Maintaining item component inner state is a trouble here, recommend to use only props data." />
55

66
<div class="example-content">
77
<tab v-on:tab-change="onTabChange" />

0 commit comments

Comments
 (0)