z-vue-design 0.0.1
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/.vscode/extensions.json +3 -0
- package/README.md +29 -0
- package/index.html +13 -0
- package/jsconfig.json +8 -0
- package/package.json +28 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +9 -0
- package/src/api/index.js +145 -0
- package/src/components/z-button.vue +52 -0
- package/src/index.js +16 -0
- package/src/main.js +14 -0
- package/src/router/index.js +23 -0
- package/src/stores/counter.js +6 -0
- package/src/stores/myTest.html +28 -0
- package/src/views/AboutView.vue +15 -0
- package/src/views/HomeView.vue +16 -0
- package/vite.config.js +47 -0
- package/z-vue-design/favicon.ico +0 -0
- package/z-vue-design/z-vue-design.css +1 -0
- package/z-vue-design/z-vue-design.js +48 -0
- package/z-vue-design/z-vue-design.umd.cjs +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ai-report
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
8
|
+
|
|
9
|
+
## Customize configuration
|
|
10
|
+
|
|
11
|
+
See [Vite Configuration Reference](https://vite.dev/config/).
|
|
12
|
+
|
|
13
|
+
## Project Setup
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Compile and Hot-Reload for Development
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm run dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Compile and Minify for Production
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm run build
|
|
29
|
+
```
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "z-vue-design",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"start": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@ant-design/icons-vue": "^7.0.1",
|
|
13
|
+
"ant-design-vue": "^4.2.6",
|
|
14
|
+
"axios": "^1.8.0",
|
|
15
|
+
"node-sass": "^9.0.0",
|
|
16
|
+
"pinia": "^3.0.1",
|
|
17
|
+
"sass": "^1.86.0",
|
|
18
|
+
"sass-loader": "^16.0.5",
|
|
19
|
+
"uuid": "^11.1.0",
|
|
20
|
+
"vue": "^3.5.13",
|
|
21
|
+
"vue-router": "^4.5.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
25
|
+
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
26
|
+
"vite": "^6.1.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
Binary file
|
package/src/App.vue
ADDED
package/src/api/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
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;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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");
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1,28 @@
|
|
|
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>
|
|
@@ -0,0 +1,16 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.z-button[data-v-eaabf67d]{display:inline-block;padding:.5rem 1rem;font-size:1rem;color:#fff;background-color:#007bff;border:none;border-radius:.25rem;cursor:pointer;transition:background-color .3s ease}.z-button[data-v-eaabf67d]:hover{background-color:#0056b3;color:#fff}.z-button[data-v-eaabf67d]:disabled{background-color:#6c757d;cursor:not-allowed}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { resolveComponent as u, createBlock as c, openBlock as r, withCtx as d, renderSlot as p } from "vue";
|
|
2
|
+
import { Button as l } from "ant-design-vue";
|
|
3
|
+
const f = (e, t) => {
|
|
4
|
+
const n = e.__vccOpts || e;
|
|
5
|
+
for (const [o, a] of t)
|
|
6
|
+
n[o] = a;
|
|
7
|
+
return n;
|
|
8
|
+
}, _ = {
|
|
9
|
+
name: "ZButton",
|
|
10
|
+
components: {
|
|
11
|
+
AButton: l
|
|
12
|
+
}
|
|
13
|
+
}, i = /* @__PURE__ */ Object.assign(_, {
|
|
14
|
+
props: {
|
|
15
|
+
type: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "button"
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(e) {
|
|
25
|
+
return (t, n) => {
|
|
26
|
+
const o = u("a-button");
|
|
27
|
+
return r(), c(o, {
|
|
28
|
+
class: "z-button",
|
|
29
|
+
type: "default"
|
|
30
|
+
}, {
|
|
31
|
+
default: d(() => [
|
|
32
|
+
p(t.$slots, "default", {}, void 0, !0)
|
|
33
|
+
]),
|
|
34
|
+
_: 3
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}), m = /* @__PURE__ */ f(i, [["__scopeId", "data-v-eaabf67d"]]), b = [m], s = function(e) {
|
|
39
|
+
s.installed || b.map((t) => e.component(t.name, t));
|
|
40
|
+
};
|
|
41
|
+
typeof window < "u" && window.Vue && s(window.Vue);
|
|
42
|
+
const y = {
|
|
43
|
+
install: s
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
m as ZButton,
|
|
47
|
+
y as default
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("ant-design-vue")):typeof define=="function"&&define.amd?define(["exports","vue","ant-design-vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.ZVueDesign={},e.Vue,e.antDesignVue))})(this,function(e,t,a){"use strict";const f=(o,n)=>{const s=o.__vccOpts||o;for(const[i,l]of n)s[i]=l;return s},c={name:"ZButton",components:{AButton:a.Button}},d=f(Object.assign(c,{props:{type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},setup(o){return(n,s)=>{const i=t.resolveComponent("a-button");return t.openBlock(),t.createBlock(i,{class:"z-button",type:"default"},{default:t.withCtx(()=>[t.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3})}}}),[["__scopeId","data-v-eaabf67d"]]),r=[d],u=function(o){u.installed||r.map(n=>o.component(n.name,n))};typeof window<"u"&&window.Vue&&u(window.Vue);const p={install:u};e.ZButton=d,e.default=p,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|