pixel-flow-vue 1.0.17 → 1.0.19

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 +226 -3
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,5 +1,228 @@
1
- # Vue 3 + TypeScript + Vite
1
+ # Pixel Flow Vue
2
2
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
3
+ 一个基于 Vue 3 Vant UI 的移动端业务组件库,专为电商场景设计,提供常用的页面组件。
4
4
 
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
5
+ ## 功能特性
6
+
7
+ - ✨ 基于 Vue 3 Composition API
8
+ - 📦 轻量级组件库
9
+ - 🎨 预设电商常用组件
10
+ - 📝 完整的 TypeScript 支持
11
+ - 🎯 按需引入
12
+
13
+ ## 安装
14
+
15
+ ```bash
16
+ npm install pixel-flow-vue vant
17
+ # 或者
18
+ yarn add pixel-flow-vue vant
19
+ # 或者
20
+ pnpm add pixel-flow-vue vant
21
+ ```
22
+
23
+ ## 快速开始
24
+
25
+ ### 完整引入
26
+
27
+ ```typescript
28
+ import { createApp } from 'vue'
29
+ import App from './App.vue'
30
+ import Vant, { Lazyload } from 'vant'
31
+ import 'vant/lib/index.css'
32
+ import pixelFlowVue from 'pixel-flow-vue'
33
+ import 'pixel-flow-vue/dist/pixel-flow-vue.css'
34
+
35
+ const app = createApp(App)
36
+ app.use(Vant)
37
+ app.use(Lazyload)
38
+ app.use(pixelFlowVue)
39
+ app.mount('#app')
40
+ ```
41
+
42
+ ### 按需引入
43
+
44
+ ```typescript
45
+ import { createApp } from 'vue'
46
+ import App from './App.vue'
47
+ import Vant, { Lazyload } from 'vant'
48
+ import 'vant/lib/index.css'
49
+ import { hxButton, hxAdGrid, hxBannerSwipe, hxHotSaleList } from 'pixel-flow-vue'
50
+ import 'pixel-flow-vue/dist/pixel-flow-vue.css'
51
+
52
+ const app = createApp(App)
53
+ app.use(Vant)
54
+ app.use(Lazyload)
55
+ app.use(hxButton)
56
+ app.use(hxAdGrid)
57
+ app.use(hxBannerSwipe)
58
+ app.use(hxHotSaleList)
59
+ app.mount('#app')
60
+ ```
61
+
62
+ ## 组件列表
63
+
64
+ ### 1. hx-button
65
+
66
+ 基础按钮组件
67
+
68
+ ```vue
69
+ <template>
70
+ <hx-button />
71
+ </template>
72
+ ```
73
+
74
+ ### 2. hx-adgrid
75
+
76
+ 三图广告位组件
77
+
78
+ ```vue
79
+ <template>
80
+ <hx-adgrid />
81
+ </template>
82
+ ```
83
+
84
+ **数据结构:**
85
+
86
+ ```typescript
87
+ import type { AdItem } from 'pixel-flow-vue'
88
+
89
+ const adItem: AdItem = {
90
+ id: 1,
91
+ imageUrl: 'https://example.com/image.jpg',
92
+ linkUrl: 'https://example.com',
93
+ title: '广告标题'
94
+ }
95
+ ```
96
+
97
+ ### 3. hx-banner-swipe
98
+
99
+ 轮播图组件
100
+
101
+ ```vue
102
+ <template>
103
+ <hx-banner-swipe />
104
+ </template>
105
+ ```
106
+
107
+ **数据结构:**
108
+
109
+ ```typescript
110
+ import type { BannerItem } from 'pixel-flow-vue'
111
+
112
+ const bannerItem: BannerItem = {
113
+ id: 1,
114
+ imageUrl: 'https://example.com/banner.jpg',
115
+ linkUrl: 'https://example.com',
116
+ title: '轮播标题'
117
+ }
118
+ ```
119
+
120
+ ### 4. hx-hotSaleList
121
+
122
+ 热卖商品列表组件
123
+
124
+ ```vue
125
+ <template>
126
+ <hx-hotSaleList title="热卖推荐" />
127
+ </template>
128
+ ```
129
+
130
+ **Props:**
131
+
132
+ | 属性 | 说明 | 类型 | 默认值 |
133
+ |------|------|------|--------|
134
+ | title | 标题 | string | '热卖推荐' |
135
+
136
+ **数据结构:**
137
+
138
+ ```typescript
139
+ import type { ProductItem } from 'pixel-flow-vue'
140
+
141
+ const productItem: ProductItem = {
142
+ id: 1,
143
+ name: '商品名称',
144
+ price: '99.99',
145
+ imageUrl: 'https://example.com/product.jpg',
146
+ linkUrl: 'https://example.com/product'
147
+ }
148
+ ```
149
+
150
+ ## 类型定义
151
+
152
+ ```typescript
153
+ // 轮播图单项
154
+ interface BannerItem {
155
+ id: string | number
156
+ imageUrl: string
157
+ linkUrl?: string
158
+ title?: string
159
+ }
160
+
161
+ // 广告位单项
162
+ interface AdItem {
163
+ id: string | number
164
+ imageUrl: string
165
+ linkUrl?: string
166
+ title?: string
167
+ }
168
+
169
+ // 商品项
170
+ interface ProductItem {
171
+ id: string | number
172
+ name: string
173
+ price: string | number
174
+ imageUrl: string
175
+ linkUrl?: string
176
+ }
177
+
178
+ // 主题商品项
179
+ interface ThemeProductItem extends ProductItem {
180
+ tag?: string
181
+ originalPrice: string | number
182
+ }
183
+ ```
184
+
185
+ ## 依赖说明
186
+
187
+ 本组件库依赖以下库,请确保项目中已正确安装:
188
+
189
+ - `vue`: ^3.0.0
190
+ - `vant`: ^4.0.0 || ^5.0.0
191
+
192
+ ## 开发
193
+
194
+ ```bash
195
+ # 安装依赖
196
+ npm install
197
+
198
+ # 开发模式
199
+ npm run dev
200
+
201
+ # 构建
202
+ npm run build
203
+
204
+ # 预览
205
+ npm run preview
206
+ ```
207
+
208
+ ## 项目结构
209
+
210
+ ```
211
+ pixel-flow-vue/
212
+ ├── dist/ # 构建输出
213
+ ├── examples/ # 示例代码
214
+ ├── packages/ # 组件源码
215
+ │ ├── hx-adgrid/ # 广告位组件
216
+ │ ├── hx-banner-swipe/ # 轮播图组件
217
+ │ ├── hx-button/ # 按钮组件
218
+ │ ├── hx-hotsaleList/ # 热卖列表组件
219
+ │ ├── index.ts # 组件入口
220
+ │ └── types.ts # 类型定义
221
+ ├── package.json
222
+ ├── vite.config.ts
223
+ └── pixel-flow-vue.d.ts # 类型声明
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixel-flow-vue",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "type": "module",
5
5
  "main": "dist/pixel-flow-vue.umd.js",
6
6
  "module": "dist/pixel-flow-vue.es.js",
@@ -28,6 +28,7 @@
28
28
  "@vitejs/plugin-vue-jsx": "^5.1.5",
29
29
  "@vue/tsconfig": "^0.9.1",
30
30
  "typescript": "~6.0.2",
31
+ "vant": "^4.9.24",
31
32
  "vite": "^8.0.12",
32
33
  "vue-tsc": "^3.2.8"
33
34
  }