vane-waterfall 1.0.2 → 1.0.3
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/README.md +12 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
### 🔌 插件化架构
|
|
16
16
|
|
|
17
17
|
- 基于事件总线的插件系统,支持灵活组合
|
|
18
|
-
-
|
|
18
|
+
- 30+ 内置插件,覆盖各种使用场景
|
|
19
19
|
- 易于扩展,支持自定义插件开发(如 `calculateItemPosition` 覆盖布局)
|
|
20
20
|
|
|
21
21
|
### 🧱 布局与渲染
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
withPlugins,
|
|
112
112
|
createAlignmentPlugin,
|
|
113
113
|
createTransitionPlugin,
|
|
114
|
-
} from "
|
|
114
|
+
} from "vane-lazy";
|
|
115
115
|
|
|
116
116
|
const Waterfall = withPlugins(WaterfallCore, [
|
|
117
117
|
createAlignmentPlugin({ mode: "shortest" }),
|
|
@@ -123,7 +123,7 @@ const Waterfall = withPlugins(WaterfallCore, [
|
|
|
123
123
|
|
|
124
124
|
```tsx
|
|
125
125
|
// ❌ 不推荐:一次性导入所有插件(会失去 Tree-Shaking 优势)
|
|
126
|
-
import * as Waterfall from "
|
|
126
|
+
import * as Waterfall from "vane-lazy";
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### 按需导入示例
|
|
@@ -131,10 +131,7 @@ import * as Waterfall from "@/components/WaterfallPlugin";
|
|
|
131
131
|
#### 方式一:精确导入(最小体积)
|
|
132
132
|
|
|
133
133
|
```tsx
|
|
134
|
-
import { WaterfallCore } from "
|
|
135
|
-
import { withPlugins } from "@/components/WaterfallPlugin";
|
|
136
|
-
import { createAlignmentPlugin } from "@/components/WaterfallPlugin/custom-plugins/Alignment";
|
|
137
|
-
import { createTransitionPlugin } from "@/components/WaterfallPlugin/custom-plugins/Transition";
|
|
134
|
+
import { WaterfallCore, withPlugins, createAlignmentPlugin, createTransitionPlugin } from "vane-lazy";
|
|
138
135
|
```
|
|
139
136
|
|
|
140
137
|
#### 方式二:分类导入(推荐)
|
|
@@ -145,7 +142,7 @@ import {
|
|
|
145
142
|
withPlugins,
|
|
146
143
|
createAutoColumnPlugin,
|
|
147
144
|
createResponsiveColumnsPlugin,
|
|
148
|
-
} from "
|
|
145
|
+
} from "vane-lazy";
|
|
149
146
|
```
|
|
150
147
|
|
|
151
148
|
#### 方式三:分组导入
|
|
@@ -155,7 +152,7 @@ import {
|
|
|
155
152
|
createAlignmentPlugin,
|
|
156
153
|
createFixedHeightPlugin,
|
|
157
154
|
createGapPlugin,
|
|
158
|
-
} from "
|
|
155
|
+
} from "vane-lazy";
|
|
159
156
|
```
|
|
160
157
|
|
|
161
158
|
### 不同场景的包大小对比(示意)
|
|
@@ -175,9 +172,7 @@ import {
|
|
|
175
172
|
const Waterfall = withPlugins(WaterfallCore, [createTransitionPlugin()]);
|
|
176
173
|
|
|
177
174
|
async function loadAdvancedPlugins() {
|
|
178
|
-
const { createVirtualWaterfallPlugin } = await import(
|
|
179
|
-
"@/components/WaterfallPlugin/custom-plugins/VirtualWaterfall"
|
|
180
|
-
);
|
|
175
|
+
const { createVirtualWaterfallPlugin } = await import("vane-lazy");
|
|
181
176
|
return [createVirtualWaterfallPlugin()];
|
|
182
177
|
}
|
|
183
178
|
```
|
|
@@ -191,7 +186,7 @@ export default {
|
|
|
191
186
|
rollupOptions: {
|
|
192
187
|
output: {
|
|
193
188
|
manualChunks: {
|
|
194
|
-
waterfall: ["
|
|
189
|
+
waterfall: ["vane-lazy"],
|
|
195
190
|
},
|
|
196
191
|
},
|
|
197
192
|
},
|
|
@@ -209,8 +204,8 @@ module.exports = {
|
|
|
209
204
|
splitChunks: {
|
|
210
205
|
cacheGroups: {
|
|
211
206
|
waterfall: {
|
|
212
|
-
test: /
|
|
213
|
-
name: "
|
|
207
|
+
test: /vane-lazy/,
|
|
208
|
+
name: "vane-lazy",
|
|
214
209
|
chunks: "all",
|
|
215
210
|
},
|
|
216
211
|
},
|
|
@@ -234,7 +229,7 @@ module.exports = {
|
|
|
234
229
|
### 基础使用
|
|
235
230
|
|
|
236
231
|
```tsx
|
|
237
|
-
import { WaterfallCore } from "
|
|
232
|
+
import { WaterfallCore } from "vane-lazy";
|
|
238
233
|
|
|
239
234
|
<WaterfallCore
|
|
240
235
|
items={items}
|
|
@@ -254,7 +249,7 @@ import {
|
|
|
254
249
|
createAutoColumnPlugin,
|
|
255
250
|
createResponsiveColumnsPlugin,
|
|
256
251
|
createTransitionPlugin,
|
|
257
|
-
} from "
|
|
252
|
+
} from "vane-lazy";
|
|
258
253
|
|
|
259
254
|
const Waterfall = withPlugins(WaterfallCore, [
|
|
260
255
|
createAutoColumnPlugin({ minColumnWidth: 220 }),
|