@gonsin/gview 1.1.3 → 1.1.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
@@ -30,7 +30,7 @@ npm run build
30
30
  npm publish
31
31
  ```
32
32
 
33
- ## 实例项目运行
33
+ ## `example` 项目运行
34
34
 
35
35
  ```sh
36
36
  cd example
@@ -42,10 +42,14 @@ npm run serve
42
42
 
43
43
  详细参考 `example` 项目。
44
44
 
45
- `main.js` 配置:
45
+ 1. 项目入口文件 `main.js` 配置:
46
46
 
47
47
  ```js
48
- // 引入 GView 标签
48
+ import store from "./store";
49
+
50
+ import TDesign from "tdesign-vue";
51
+ Vue.use(TDesign);
52
+
49
53
  import GView from "@gonsin/gview";
50
54
  Vue.use(GView, { store });
51
55
 
@@ -55,7 +59,9 @@ new Vue({
55
59
  }).$mount("#app");
56
60
  ```
57
61
 
58
- 根据开发修改接口的地址:
62
+ > 注意目前 GView 依赖于 TDesign,所以需要引入 TDesign;另外需要在 `Vue.use(GView, { store })` 中传入 `Vuex` 的 `store`,以便动态注册 GView 的 `store` 模块。
63
+
64
+ 2. 根据开发修改代理服务的接口地址:
59
65
 
60
66
  ```js
61
67
  proxy: {
@@ -79,33 +85,108 @@ proxy: {
79
85
 
80
86
  ```
81
87
 
82
- 另外 GView 提供了已经封装好的 axios 工具,可以直接引入使用:
88
+ 3. 设置与 GView 相关的路由映射:
89
+
90
+ ```js
91
+ const routes = [
92
+ {
93
+ path: "/view",
94
+ name: "home",
95
+ component: () => import("../views/HomeView.vue"),
96
+ },
97
+ {
98
+ path: "/login",
99
+ name: "login",
100
+ component: () => import("../views/LoginView.vue"),
101
+ },
102
+ {
103
+ redirect: "/login",
104
+ path: "/",
105
+ },
106
+ ];
107
+ ```
108
+
109
+ > 与 GView 路由组件相关的路由路径 `path` 必须设置为 `/view`;登录页面的路由路径必须设置为 `/login`;根据需求设置重定向以及路由守卫。具体参考 `example/src/router/index.js`。
110
+
111
+ 4. GView 组件的具体用法:
112
+
113
+ ```html
114
+ <template>
115
+ <GView :config="{ ...defaultConfig, ...config }" />
116
+ </template>
117
+ ```
118
+
119
+ > `:config` 传入用户登录信息以及登录权限菜单;另外可后续传入更多自定义配置。 具体参考 `example/src/views/HomeView.vue`。
120
+
121
+ 5. 另外 GView 提供了已经封装好的 axios 工具以及规范的存储常量名称,可以直接引入使用:
83
122
 
84
123
  ```js
85
124
  // 引入提供的axios封装工具
86
125
  import { http } from "@gonsin/gview";
126
+
127
+ // 以用户登录接口为例,使用 http.post 方法发送 POST 请求:
128
+ export const loginApi = (params) => {
129
+ return http.post(loginApiUrl.loginUrl, qs.stringify(params));
130
+ };
87
131
  ```
88
132
 
133
+ ```js
134
+ import { config } from "@gonsin/gview";
135
+
136
+ // 存入 sessionStorage 最好使用 config 给出的相关常量:
137
+ sessionStorage.setItem(config.LOCAL_USER, JSON.stringify(res.data));
138
+ ```
139
+
140
+ > 更多用法参考 `example/src/store/modules/user.js` 。
141
+
89
142
  ## 版本更新日志
90
143
 
91
- ### 1.1.0
144
+ ### 1.1.0 `2022-12-12`
92
145
 
93
146
  - 使用 TypeScript + TDesign 重构项目代码,更换掉原来的组件库 ElementUI。
94
147
 
95
- ### 1.1.1
148
+ ### 1.1.1 `2022-12-12`
96
149
 
97
150
  - fix(7e6faa2): `GTab`/`GDialog` 修复 tab 和对话框动态加载组件出错问题
98
151
  - fix(efe8365): `GForm`/`GTable` 修复 v 方法找不到导致动态渲染内容无法显示问题
99
152
  - fix(e301593): `GLayout` 修复头部下拉框消失问题
100
153
  - fix(840a93a): 修改打包构建配置
101
154
 
102
- ### 1.1.2
155
+ ### 1.1.2 `2022-12-12`
103
156
 
104
157
  - fix(06c7839): 修复 babel 依赖打包后报错问题
105
158
 
106
- ### 1.1.3
159
+ ### 1.1.3 `2022-12-13`
107
160
 
108
161
  - fix(f10e6e4): `GForm` 修改 TreeCheckBox 选中值模式包括父节点
109
162
  - fix(c80791f): `GLayout` 修复切换 tab 菜单时丢失路径携带的参数导致页面空白的问题
110
163
  - fix(f934526): `GTable` 完善表格视图的分页功能
111
164
  - fix(9c90248): 完善路由守卫
165
+
166
+ ### 1.1.4 `2022-12-16`
167
+
168
+ - fix(82e545e): 将登录后初始化用户信息及菜单等逻辑转入 GView 包内进行:
169
+ - 涉及 `example` 用法的更新,使用 GView 组件时传入用户登录后的信息、菜单即可
170
+ - 更加方便之后传入更多自定义的配置到 GView 中
171
+ - fix(8a3d5d9): 处理重复路由跳转报错
172
+ - feat(5373d6b): `GForm` 完善表单隐藏项目类型
173
+ - feat(b532d8e): `Auth` 完善传入的 token 以及在每个请求头中添加 token 字段
174
+ - fix(f1067bd): 修复刷新后回到首页问题
175
+ - fix(e25aa5a): 修改样式以及规范样式类命名
176
+ - fix(275d821): 解决打包时的变量丢失问题
177
+ - fix(3387471): 调整用户登录相关的逻辑
178
+
179
+ ### 1.1.5 `2022-12-17`
180
+
181
+ - `GForm`:
182
+ - fix(dfadcc4): 修复部分表单类型的 showIf 不起作用的问题
183
+ - fix(76738e9): 调整上传组件的 placeholder
184
+ - fix(08c540f): 修复表单 key 重复报错及空白问题
185
+ - fix(e60277d): `GView` 解决请求访问 view 数据为空报错的问题
186
+ - fix(f085ea7): `GDialog` 完善对话框表单请求数据
187
+ - feat(a46a7a3): `GHeader` 完善头部搜索过滤数据功能
188
+ - fix(5c39de4): `GForm` 修改表单选择下拉数据携带查询参数
189
+ - feat(d931ff0): `GForm` 完善表单动态 disableIf 功能
190
+ - fix(f0dbd8a): 修复过滤菜单时可能报错导致页面空白问题
191
+ - feat(6aef710): 新增系统设置面板相关功能
192
+ - fix(c49137f): 修改获取用户菜单的接口路径