@loickit-v/swiper 0.0.2 → 0.0.4

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.
Files changed (2) hide show
  1. package/README.md +151 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,152 @@
1
1
  # @loickit-v/swiper
2
+
3
+ ## Components
4
+
5
+ ### LSlide
6
+
7
+ the Slide Component
8
+
9
+ #### Props
10
+
11
+ - name
12
+
13
+ identification of this slide, get by `defineSlide`
14
+
15
+ - list \<Array>
16
+
17
+ just avaliable `infinite` mode, the long list of render, will cached by `slotScope.cacheList`
18
+
19
+ - loadMore \<Function>
20
+
21
+ just avaliable `infinite` mode, when the pointer points to the cacheList end, will trigger.
22
+
23
+ #### Hooks
24
+
25
+ **defineSlide**
26
+
27
+ define a slide object
28
+
29
+ argument:
30
+
31
+ - provideKey \<string>
32
+
33
+ the identification of target slide
34
+
35
+ return \[createSlide, useSlide]
36
+
37
+ - createSlide
38
+
39
+ create a slide states, use return value to registe a slide
40
+
41
+ params:
42
+
43
+ - initial \<SlideState>
44
+
45
+ - direction \<SLIDE\*DIRECTION> _optional_
46
+
47
+ default: SLIDE_DIRECTION.HORIZONTAL
48
+
49
+ direction
50
+
51
+ - currentIndex \<number> _optional_
52
+
53
+ pointer
54
+
55
+ - duration \<number> _optional_
56
+
57
+ slide switch animation duration
58
+
59
+ - infinite \<boolean> `infinite` _optional_
60
+
61
+ mode enable
62
+
63
+ return:
64
+
65
+ - name
66
+
67
+ the identification of target slide
68
+
69
+ - state \<SlideState>
70
+
71
+ the slide state
72
+
73
+ - useSlide
74
+
75
+ return: \<SlideSate>
76
+
77
+ use it to get slide state in any child component
78
+
79
+ #### Slot
80
+
81
+ **default**
82
+
83
+ - cacheList
84
+
85
+ the cache data of list, just cache 3, just avaliable `infinite` mode
86
+
87
+ ### LSlideItem
88
+
89
+ #### Props
90
+
91
+ - index \<number> optional
92
+
93
+ the index of this slide item, required when `infinite` mode
94
+
95
+ ### Usage
96
+
97
+ ```vue
98
+ <script setup lang="ts">
99
+ import {
100
+ defineSlide,
101
+ LSlide,
102
+ LSlideItem,
103
+ SLIDE_DIRECTION
104
+ } from '@loickit-v/swiper';
105
+
106
+ defineOptions({ name: 'App' });
107
+
108
+ const [createSlide] = defineSlide('one');
109
+
110
+ const oneSlide = createSlide({
111
+ currentIndex: 1
112
+ });
113
+
114
+ const [createSlide2] = defineSlide('two');
115
+
116
+ const twoSlide = createSlide2({
117
+ direction: SLIDE_DIRECTION.VERTICAL
118
+ });
119
+
120
+ const oneToTwo = () => {
121
+ oneSlide.state.currentIndex = 2;
122
+ };
123
+ </script>
124
+
125
+ <template>
126
+ <LSlide :name="oneSlide.name">
127
+ <LSlideItem style="background-color: red; width: 30%">1</LSlideItem>
128
+ <LSlideItem style="background-color: blue">2</LSlideItem>
129
+ <LSlideItem style="background-color: green">
130
+ <LSlide :name="twoSlide.name">
131
+ <LSlideItem style="background-color: pink; height: 30%">1</LSlideItem>
132
+ <LSlideItem style="background-color: orange">2</LSlideItem>
133
+ <LSlideItem style="background-color: yellow">3</LSlideItem>
134
+ </LSlide>
135
+ </LSlideItem>
136
+ </LSlide>
137
+
138
+ <p>one currentIndex: {{ oneSlide.state.currentIndex }}</p>
139
+ <p>two currentIndex: {{ twoSlide.state.currentIndex }}</p>
140
+
141
+ <button @click="oneToTwo">click to two slide</button>
142
+ </template>
143
+
144
+ <style lang="scss">
145
+ body,
146
+ #app {
147
+ background-color: #ccc;
148
+ height: 800px;
149
+ width: 800px;
150
+ }
151
+ </style>
152
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loickit-v/swiper",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "loickit swiper components for vue",
5
5
  "type": "module",
6
6
  "types": "./dist/types/index.d.ts",