meixioacomponent 0.3.25 → 0.3.28
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/lib/meixioacomponent.common.js +280 -269
- package/lib/meixioacomponent.umd.js +280 -269
- package/lib/meixioacomponent.umd.min.js +14 -14
- package/package.json +41 -41
- package/packages/components/base/baseAvatar/baseAvatar.vue +27 -12
- package/packages/components/base/baseButtonHandle/baseButtonHandle.vue +13 -11
- package/packages/components/proForm/proForm/pro_form.vue +0 -1
- package/packages/components/proForm/proForm/pro_form_item.vue +8 -8
- package/src/App.vue +65 -0
- package/src/assets/logo.png +0 -0
- package/src/component/test.vue +960 -0
- package/src/component/testSelectStore.js +43 -0
- package/src/config/request.js +66 -0
- package/src/config/testApi.js +12 -0
- package/src/main.js +27 -0
- package/src/router/index.js +14 -0
- package/src/store/index.js +15 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import meixioacomponent from "../../packages/components/index";
|
|
2
|
+
// 示例
|
|
3
|
+
let testRequest = () => {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
setTimeout(() => {
|
|
6
|
+
resolve([
|
|
7
|
+
{
|
|
8
|
+
value: 1,
|
|
9
|
+
label: "黄金糕",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: 2,
|
|
13
|
+
label: "双皮奶",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: 3,
|
|
17
|
+
label: "蚵仔煎",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 4,
|
|
21
|
+
label: "龙须面",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 5,
|
|
25
|
+
label: "北京烤鸭",
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
}, 5000);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class TestSelectStore extends meixioacomponent.SelectStore {
|
|
33
|
+
constructor(params) {
|
|
34
|
+
super(params);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let testSelectStore = new TestSelectStore({
|
|
39
|
+
name: "testSelectStore",
|
|
40
|
+
request: testRequest,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default testSelectStore;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
// 创建 axios 实例
|
|
3
|
+
const instance = axios.create({
|
|
4
|
+
// API 请求的默认前缀
|
|
5
|
+
baseURL: "/api",
|
|
6
|
+
timeout: 10000, // 请求超时时间
|
|
7
|
+
withCredentials: true, // 携带cookie
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// 异常拦截处理器
|
|
11
|
+
const errorHandler = (error) => {
|
|
12
|
+
// responceError(error);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// 响应异常拦截处理器
|
|
16
|
+
const resErrorHandler = (error) => {
|
|
17
|
+
console.log(error);
|
|
18
|
+
return errorHandler(error);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// request interceptor
|
|
22
|
+
instance.interceptors.request.use(async (config) => {
|
|
23
|
+
// 设置接口auth权限配置
|
|
24
|
+
if (config.headers.auth) {
|
|
25
|
+
tokenSecurity(config, true);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return config;
|
|
29
|
+
}, errorHandler);
|
|
30
|
+
|
|
31
|
+
const responseHandle = async (response) => {
|
|
32
|
+
//console.log(response)
|
|
33
|
+
if (response.status === 200) {
|
|
34
|
+
let data = response.data;
|
|
35
|
+
if (data.code == 200) {
|
|
36
|
+
if (data.data) return data.data;
|
|
37
|
+
return data;
|
|
38
|
+
} else {
|
|
39
|
+
errorHandler(data);
|
|
40
|
+
throw data;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// response interceptor
|
|
46
|
+
instance.interceptors.response.use(responseHandle, resErrorHandler);
|
|
47
|
+
|
|
48
|
+
export default (params, _auth = true, _otherUrl = false) => {
|
|
49
|
+
params.headers = {
|
|
50
|
+
auth: _auth,
|
|
51
|
+
otherUrl: _otherUrl,
|
|
52
|
+
};
|
|
53
|
+
return instance(params);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// 配置token
|
|
57
|
+
const tokenSecurity = (config, auth) => {
|
|
58
|
+
// 设置接口auth权限配置
|
|
59
|
+
if (auth) {
|
|
60
|
+
const token = window.localStorage.getItem("token") || "";
|
|
61
|
+
config.headers["Authorization"] = `${token}`;
|
|
62
|
+
|
|
63
|
+
config.headers.timestamp = time;
|
|
64
|
+
config.headers.signstr = keys;
|
|
65
|
+
}
|
|
66
|
+
};
|
package/src/main.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import App from "./App.vue";
|
|
3
|
+
import store from "./store";
|
|
4
|
+
import router from "./router";
|
|
5
|
+
import ElementUI from "element-ui";
|
|
6
|
+
import meixioacomponent from "../packages/components/index";
|
|
7
|
+
import testSelectStore from "./component/testSelectStore";
|
|
8
|
+
import "../packages/components/style/index.less";
|
|
9
|
+
meixioacomponent.componentConfig.initConfig(store, router);
|
|
10
|
+
meixioacomponent.componentConfig.setUploadPrefix(
|
|
11
|
+
"http://192.168.31.156:9999/files/files"
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
Vue.use(ElementUI);
|
|
15
|
+
Vue.use(meixioacomponent);
|
|
16
|
+
|
|
17
|
+
meixioacomponent.componentConfig.selectStore.registerStore({
|
|
18
|
+
name: "testSelectStore",
|
|
19
|
+
class: testSelectStore,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
Vue.config.productionTip = false;
|
|
23
|
+
new Vue({
|
|
24
|
+
router,
|
|
25
|
+
store,
|
|
26
|
+
render: (h) => h(App),
|
|
27
|
+
}).$mount("#app");
|