@vue-ui-kit/ant 1.8.3 → 1.8.5

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 CHANGED
@@ -16,23 +16,160 @@ yarn add @vue-ui-kit/ant
16
16
  pnpm add @vue-ui-kit/ant
17
17
  ```
18
18
 
19
+ ## Quick Start
20
+
21
+ ### 1. Basic Usage
22
+
19
23
  ```ts
20
24
  /*main.ts*/
21
25
  import { createApp } from 'vue';
22
26
  import App from './App.vue';
23
27
  import Antd from 'ant-design-vue';
24
28
  import UIKit from '@vue-ui-kit/ant';
25
- import '@vue-ui-kit/ant/scss';
26
- /*Create renderer (recommended to use tsx)*/
27
- import { setupKit } from './setup/kit.tsx';
28
29
 
29
- /*Create formatter*/
30
- UIKit.addFormatter({
31
- test: ({ row, column, cellValue }) => 'test:...' + 'field:' + column.field + '...v:' + cellvalue,
30
+ // Import styles - choose one of the following methods:
31
+ // Method 1: Import SCSS source files (recommended, allows variable override)
32
+ import '@vue-ui-kit/ant/style.scss';
33
+
34
+ // Method 2: Import compiled CSS file
35
+ // import '@vue-ui-kit/ant/style.css';
36
+
37
+ createApp(App).use(Antd).use(UIKit).mount('#app');
38
+ ```
39
+
40
+ ### 2. Configure Global Defaults
41
+
42
+ ```ts
43
+ /*main.ts*/
44
+ import { createApp } from 'vue';
45
+ import App from './App.vue';
46
+ import Antd from 'ant-design-vue';
47
+ import UIKit, { setup } from '@vue-ui-kit/ant';
48
+ import '@vue-ui-kit/ant/style.scss';
49
+
50
+ // Configure global defaults
51
+ setup({
52
+ form: {
53
+ labelCol: { span: 8 }, // Modify form label column width
54
+ wrapperCol: { span: 14 }, // Modify form input column width
55
+ },
56
+ grid: {
57
+ align: 'center', // Set default table alignment
58
+ lazyReset: true, // Don't auto-submit after reset
59
+ fitHeight: 200, // Set adaptive height
60
+ }
32
61
  });
62
+
33
63
  createApp(App).use(Antd).use(UIKit).mount('#app');
34
64
  ```
35
65
 
66
+ ### 3. Alternative import methods (if main method doesn't work)
67
+
68
+ If you encounter issues with the standard import, try these alternatives:
69
+
70
+ ```scss
71
+ // In your main.scss file
72
+ @import '@vue-ui-kit/ant/dist/style.scss';
73
+ ```
74
+
75
+ ```ts
76
+ // Or using require in JavaScript/TypeScript
77
+ require('@vue-ui-kit/ant/style.css');
78
+ ```
79
+
80
+ ### 4. For Vite users
81
+ If using Vite, make sure your vite.config.js includes sass support:
82
+
83
+ ```js
84
+ // vite.config.js
85
+ export default {
86
+ css: {
87
+ preprocessorOptions: {
88
+ scss: {
89
+ additionalData: `@import '@vue-ui-kit/ant/dist/style.scss';`
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## 🎯 样式文件导入 - 故障排除指南
97
+
98
+ 如果遇到样式文件导入问题,请按顺序尝试以下方法:
99
+
100
+ ### 方法1: 标准导入(推荐)
101
+ ```typescript
102
+ import '@vue-ui-kit/ant/style.scss';
103
+ // 或
104
+ import '@vue-ui-kit/ant/style.css';
105
+ ```
106
+
107
+ ### 方法2: 完整路径导入
108
+ ```typescript
109
+ import '@vue-ui-kit/ant/dist/style.scss';
110
+ // 或
111
+ import '@vue-ui-kit/ant/dist/style.css';
112
+ ```
113
+
114
+ ### 方法3: SCSS @use 语法
115
+ ```scss
116
+ @use '@vue-ui-kit/ant/style.scss';
117
+ // 或者使用完整路径
118
+ @use '@vue-ui-kit/ant/dist/style.scss';
119
+ ```
120
+
121
+ ### 方法4: 在 style 标签中
122
+ ```vue
123
+ <style lang="scss">
124
+ @import '@vue-ui-kit/ant/style.scss';
125
+ </style>
126
+ ```
127
+
128
+ ### 方法5: Vite 配置导入
129
+ ```javascript
130
+ // vite.config.js
131
+ export default defineConfig({
132
+ css: {
133
+ preprocessorOptions: {
134
+ scss: {
135
+ additionalData: `@import '@vue-ui-kit/ant/dist/style.scss';`
136
+ }
137
+ }
138
+ }
139
+ })
140
+ ```
141
+
142
+ ### 方法6: Webpack 配置
143
+ ```javascript
144
+ // webpack.config.js 或 vue.config.js
145
+ module.exports = {
146
+ css: {
147
+ loaderOptions: {
148
+ sass: {
149
+ additionalData: `@import '@vue-ui-kit/ant/dist/style.scss';`
150
+ }
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### 🔧 调试步骤
157
+
158
+ 1. **检查包版本**: 确保使用 `@vue-ui-kit/ant@1.8.4` 或更高版本
159
+ 2. **验证文件存在**: 检查 `node_modules/@vue-ui-kit/ant/dist/` 目录下是否有 `style.scss` 和 `style.css`
160
+ 3. **检查构建工具**: 确保您的构建工具支持处理 `.scss` 文件
161
+ 4. **清除缓存**: 删除 `node_modules` 和 lock 文件后重新安装
162
+
163
+ ### 📦 包内容确认
164
+ 安装后可以在以下位置找到样式文件:
165
+ ```
166
+ node_modules/@vue-ui-kit/ant/
167
+ ├── dist/
168
+ │ ├── style.css # 编译后的CSS
169
+ │ └── style.scss # SCSS源文件(已内联variables)
170
+ └── src/packages/styles/ # 源文件(开发时参考)
171
+ ```
172
+
36
173
  ```tsx
37
174
  /*kit.tsx*/
38
175
  import UIKit from '@vue-ui-kit/ant';
package/dist/style.scss CHANGED
@@ -1,4 +1,8 @@
1
- @import 'variables';
1
+ // Variables inlined for npm distribution
2
+ :root {
3
+ --p-theme-bg: #fff;
4
+ }
5
+
2
6
 
3
7
  .p-pane {
4
8
  background-color: var(--p-theme-bg);
package/package.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/es/index.js",
6
8
  "types": "./dist/index.d.ts",
9
+ "style": "./dist/style.css",
10
+ "sass": "./dist/style.scss",
7
11
  "exports": {
8
12
  ".": {
9
13
  "require": "./dist/cjs/index.js",
10
14
  "import": "./dist/es/index.js",
11
15
  "types": "./dist/index.d.ts"
12
16
  },
17
+ "./style": "./dist/style.css",
13
18
  "./style.css": "./dist/style.css",
14
- "./style.scss": "./dist/style.scss"
19
+ "./style.scss": "./dist/style.scss",
20
+ "./dist/style.css": "./dist/style.css",
21
+ "./dist/style.scss": "./dist/style.scss",
22
+ "./package.json": "./package.json"
15
23
  },
16
24
  "files": [
17
25
  "dist",
@@ -1,3 +0,0 @@
1
- :root {
2
- --p-theme-bg: #fff;
3
- }