z-vue-design 0.0.2 → 0.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/package.json +11 -2
- package/.vscode/extensions.json +0 -3
- package/index.html +0 -13
- package/jsconfig.json +0 -8
- package/public/favicon.ico +0 -0
- package/src/App.vue +0 -9
- package/src/api/index.js +0 -145
- package/src/components/z-button.vue +0 -52
- package/src/index.js +0 -16
- package/src/main.js +0 -14
- package/src/router/index.js +0 -23
- package/src/stores/counter.js +0 -6
- package/src/stores/myTest.html +0 -28
- package/src/views/AboutView.vue +0 -15
- package/src/views/HomeView.vue +0 -16
- package/vite.config.js +0 -47
- /package/z-vue-design/{z-vue-design.mjs → z-vue-design.es.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "z-vue-design",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "./z-vue-design/z-vue-design.js",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"main": "./z-vue-design/z-vue-design.umd.js",
|
|
5
|
+
"module": "./z-vue-design/z-vue-design.es.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./z-vue-design/z-vue-design.es.js",
|
|
9
|
+
"require": "./z-vue-design/z-vue-design.umd.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": ["z-vue-design"],
|
|
5
13
|
"scripts": {
|
|
6
14
|
"dev": "vite",
|
|
7
15
|
"start": "vite",
|
|
@@ -17,6 +25,7 @@
|
|
|
17
25
|
"sass": "^1.86.0",
|
|
18
26
|
"sass-loader": "^16.0.5",
|
|
19
27
|
"uuid": "^11.1.0",
|
|
28
|
+
"vite-plugin-dts": "^4.5.3",
|
|
20
29
|
"vue": "^3.5.13",
|
|
21
30
|
"vue-router": "^4.5.0"
|
|
22
31
|
},
|
package/.vscode/extensions.json
DELETED
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<link rel="icon" href="/favicon.ico">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Vite App</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/jsconfig.json
DELETED
package/public/favicon.ico
DELETED
|
Binary file
|
package/src/App.vue
DELETED
package/src/api/index.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { notification } from "ant-design-vue";
|
|
3
|
-
|
|
4
|
-
import { useRouter } from "vue-router";
|
|
5
|
-
const router = useRouter();
|
|
6
|
-
// const baseURL = process.env.NODE_ENV;
|
|
7
|
-
const mode = process.env.NODE_ENV;
|
|
8
|
-
|
|
9
|
-
const axiosInstance = axios.create({
|
|
10
|
-
baseURL: "", // 客户
|
|
11
|
-
// baseURL: LOCAL_PATH, // 测试
|
|
12
|
-
timeout: 60000,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const CancelToken = axios.CancelToken;
|
|
16
|
-
export let cancel;
|
|
17
|
-
|
|
18
|
-
axiosInstance.interceptors.request.use(
|
|
19
|
-
(config) => {
|
|
20
|
-
config.headers.Authorization = localStorage.getItem("token");
|
|
21
|
-
return config;
|
|
22
|
-
},
|
|
23
|
-
(error) => {
|
|
24
|
-
return Promise.reject(error);
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
axiosInstance.interceptors.response.use(
|
|
29
|
-
(res) => {
|
|
30
|
-
if (res.status === 200) {
|
|
31
|
-
if (!res.data.code) {
|
|
32
|
-
return Promise.resolve(res.content ?? res.data);
|
|
33
|
-
}
|
|
34
|
-
if (res.data.code === 200) {
|
|
35
|
-
return Promise.resolve(res.content ?? res.data);
|
|
36
|
-
} else {
|
|
37
|
-
notification.warning({
|
|
38
|
-
message: "警告",
|
|
39
|
-
description: res.data.message,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
return Promise.reject(res);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
(error) => {
|
|
47
|
-
const { response } = error;
|
|
48
|
-
if (response?.data?.message === "token不存在或者过期") {
|
|
49
|
-
localStorage.removeItem("token");
|
|
50
|
-
}
|
|
51
|
-
if (response) {
|
|
52
|
-
// errorHandle(response?.status, response?.data?.message)
|
|
53
|
-
return Promise.reject(response);
|
|
54
|
-
}
|
|
55
|
-
return error;
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const ANKE = getAKBaseUrl();
|
|
60
|
-
const CONFIG = getConfigUrl();
|
|
61
|
-
export const api = {
|
|
62
|
-
ANKE,
|
|
63
|
-
CONFIG,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
function request(type, base, url, params, opt = {}) {
|
|
67
|
-
return axiosInstance({
|
|
68
|
-
method: type,
|
|
69
|
-
url: `${base}${url}`,
|
|
70
|
-
...params,
|
|
71
|
-
...opt,
|
|
72
|
-
cancelToken: new CancelToken(function executor(c) {
|
|
73
|
-
cancel = c;
|
|
74
|
-
}),
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const apiMap = new Map();
|
|
79
|
-
|
|
80
|
-
Object.keys(api).forEach((val) => {
|
|
81
|
-
apiMap[val] = {
|
|
82
|
-
get: function (url, params, opt) {
|
|
83
|
-
return request(
|
|
84
|
-
"get",
|
|
85
|
-
api[val],
|
|
86
|
-
url,
|
|
87
|
-
{
|
|
88
|
-
params,
|
|
89
|
-
},
|
|
90
|
-
opt
|
|
91
|
-
);
|
|
92
|
-
},
|
|
93
|
-
post: function (url, params, opt) {
|
|
94
|
-
return request(
|
|
95
|
-
"post",
|
|
96
|
-
api[val],
|
|
97
|
-
url,
|
|
98
|
-
{
|
|
99
|
-
data: params,
|
|
100
|
-
},
|
|
101
|
-
opt
|
|
102
|
-
);
|
|
103
|
-
},
|
|
104
|
-
put: function (url, params, opt) {
|
|
105
|
-
return request(
|
|
106
|
-
"put",
|
|
107
|
-
api[val],
|
|
108
|
-
url,
|
|
109
|
-
{
|
|
110
|
-
data: params,
|
|
111
|
-
},
|
|
112
|
-
opt
|
|
113
|
-
);
|
|
114
|
-
},
|
|
115
|
-
qPost: function (url, params, opt) {
|
|
116
|
-
return request(
|
|
117
|
-
"post",
|
|
118
|
-
api[val],
|
|
119
|
-
url,
|
|
120
|
-
{
|
|
121
|
-
params,
|
|
122
|
-
},
|
|
123
|
-
opt
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
delete: function (url, params, opt) {
|
|
127
|
-
return request("delete", api[val], url, { params }, opt);
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export function getAKBaseUrl() {
|
|
133
|
-
if (mode == "development") {
|
|
134
|
-
return import.meta.env.VITE_REQUEST_URL || "http://192.168.1.134:8084";
|
|
135
|
-
} else {
|
|
136
|
-
// console.log(`http://${window.location.host}`);
|
|
137
|
-
return `http://${window.location.host}`;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function getConfigUrl() {
|
|
142
|
-
return import.meta.env.VITE_SCREEN_CONFIG || "";
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export default apiMap;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-button class="z-button" type="default">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</a-button>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { Button } from "ant-design-vue";
|
|
9
|
-
export default {
|
|
10
|
-
name: "ZButton",
|
|
11
|
-
components: {
|
|
12
|
-
AButton: Button,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<script setup>
|
|
18
|
-
defineProps({
|
|
19
|
-
type: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: "button",
|
|
22
|
-
},
|
|
23
|
-
disabled: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: false,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<style lang="scss" scoped>
|
|
31
|
-
.z-button {
|
|
32
|
-
display: inline-block;
|
|
33
|
-
padding: 0.5rem 1rem;
|
|
34
|
-
font-size: 1rem;
|
|
35
|
-
color: #fff;
|
|
36
|
-
background-color: #007bff;
|
|
37
|
-
border: none;
|
|
38
|
-
border-radius: 0.25rem;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
transition: background-color 0.3s ease;
|
|
41
|
-
|
|
42
|
-
&:hover {
|
|
43
|
-
background-color: #0056b3;
|
|
44
|
-
color: #fff;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:disabled {
|
|
48
|
-
background-color: #6c757d;
|
|
49
|
-
cursor: not-allowed;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
</style>
|
package/src/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ZButton from "@/components/z-button.vue";
|
|
2
|
-
|
|
3
|
-
const components = [ZButton];
|
|
4
|
-
|
|
5
|
-
const install = function (Vue) {
|
|
6
|
-
if (install.installed) return;
|
|
7
|
-
components.map((component) => Vue.component(component.name, component));
|
|
8
|
-
};
|
|
9
|
-
if (typeof window !== "undefined" && window.Vue) {
|
|
10
|
-
install(window.Vue);
|
|
11
|
-
}
|
|
12
|
-
export default {
|
|
13
|
-
install,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { ZButton };
|
package/src/main.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import "./assets/main.css";
|
|
2
|
-
|
|
3
|
-
import { createApp } from "vue";
|
|
4
|
-
import { createPinia } from "pinia";
|
|
5
|
-
|
|
6
|
-
import App from "./App.vue";
|
|
7
|
-
import router from "./router";
|
|
8
|
-
|
|
9
|
-
const app = createApp(App);
|
|
10
|
-
|
|
11
|
-
app.use(createPinia());
|
|
12
|
-
app.use(router);
|
|
13
|
-
|
|
14
|
-
app.mount("#app");
|
package/src/router/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
-
import HomeView from '../views/HomeView.vue'
|
|
3
|
-
|
|
4
|
-
const router = createRouter({
|
|
5
|
-
history: createWebHistory(import.meta.env.BASE_URL),
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
path: '/',
|
|
9
|
-
name: 'home',
|
|
10
|
-
component: HomeView,
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
path: '/about',
|
|
14
|
-
name: 'about',
|
|
15
|
-
// route level code-splitting
|
|
16
|
-
// this generates a separate chunk (About.[hash].js) for this route
|
|
17
|
-
// which is lazy-loaded when the route is visited.
|
|
18
|
-
component: () => import('../views/AboutView.vue'),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export default router
|
package/src/stores/counter.js
DELETED
package/src/stores/myTest.html
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Document</title>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<script>
|
|
12
|
-
let timer = null
|
|
13
|
-
|
|
14
|
-
function sum(...args) {
|
|
15
|
-
console.log(args)
|
|
16
|
-
if (timer) {
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const aum = (...innerArgs) => sum(...args, ...innerArgs)
|
|
20
|
-
aum.allNum = args.reduce((acc, cur) => acc + cur, 0);
|
|
21
|
-
return aum;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log(sum(1)(2)(3, 4).allNum); // 输出 10
|
|
25
|
-
</script>
|
|
26
|
-
</body>
|
|
27
|
-
|
|
28
|
-
</html>
|
package/src/views/AboutView.vue
DELETED
package/src/views/HomeView.vue
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<div>
|
|
4
|
-
<z-button @click="click">Click me</z-button>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup>
|
|
9
|
-
import ZButton from "@/components/z-button.vue";
|
|
10
|
-
|
|
11
|
-
const click = () => {
|
|
12
|
-
console.log("Button clicked");
|
|
13
|
-
};
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<style lang="scss" scoped></style>
|
package/vite.config.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath, URL } from "node:url";
|
|
2
|
-
|
|
3
|
-
import { defineConfig } from "vite";
|
|
4
|
-
import vue from "@vitejs/plugin-vue";
|
|
5
|
-
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
|
|
8
|
-
// https://vite.dev/config/
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
plugins: [vue(), vueJsx()],
|
|
11
|
-
resolve: {
|
|
12
|
-
alias: {
|
|
13
|
-
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
css: {
|
|
17
|
-
preprocessorOptions: {
|
|
18
|
-
scss: {
|
|
19
|
-
api: "modern-compiler", // or 'modern'
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
server: {
|
|
24
|
-
port: 5177,
|
|
25
|
-
open: true,
|
|
26
|
-
hmrWarning: false,
|
|
27
|
-
},
|
|
28
|
-
devServer: {
|
|
29
|
-
hot: true,
|
|
30
|
-
},
|
|
31
|
-
build: {
|
|
32
|
-
outDir: "z-vue-design",
|
|
33
|
-
lib: {
|
|
34
|
-
entry: path.resolve(__dirname, "src/index.js"),
|
|
35
|
-
name: "ZVueDesign",
|
|
36
|
-
fileName: "z-vue-design",
|
|
37
|
-
},
|
|
38
|
-
rollupOptions: {
|
|
39
|
-
external: ["vue", "ant-design-vue"],
|
|
40
|
-
output: {
|
|
41
|
-
globals: {
|
|
42
|
-
vue: "Vue",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
File without changes
|