Skip to content

Commit 577d3de

Browse files
committed
feat:<printerMate> add printerMate
1 parent dd397ea commit 577d3de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1175
-179
lines changed

.umirc.ts

+48-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
11
import { defineConfig } from "umi";
2-
// import GetDirectoryContentPlugin from "./plugins/getDirectoryContent"; // 确保路径正确
2+
import ScriptWebpackPlugin from "./buildScript/scriptWebpackPlugin";
33

44
const path = require("path");
55

66
export default defineConfig({
7-
outputPath: "docs", // 默认为 'dist',您可以根据需要更改此路径。
7+
/**
8+
* github pages 里选不到dist目录,就把这里的输出目录改掉
9+
* */
10+
outputPath: "docs",
811
alias: {
912
// "@": process.cwd() + "/src", // 定义 @ 别名指向 src 目录
1013
"@": path.resolve(__dirname, "src"), // 定义 @ 别名指向 src 目录
1114
"@public": path.resolve(__dirname, "public"), // 定义 @ 别名指向 src 目录
12-
// "@public": "./public",
1315
},
1416
routes: [
15-
{ path: "/", component: "index" },
16-
{ path: "/docs", component: "docs" },
17+
// 错误的路由
18+
{ path: "/*", component: "@/pages/index" },
19+
// 没有layout(layout里是空的)包裹的路由
20+
{
21+
path: "/",
22+
component: "@/layouts/index",
23+
routes: [
24+
{ path: "/", component: "index" },
25+
{ path: "/docs", component: "@/pages/docs" },
26+
],
27+
},
28+
{
29+
path: "/printerMate",
30+
component: "@/layouts/index",
31+
routes: [
32+
{
33+
path: "/printerMate",
34+
component: "@/pages/printerMate/privacyAgreement",
35+
},
36+
{
37+
path: "/printerMate/userAgreement",
38+
component: "@/pages/printerMate/userAgreement",
39+
},
40+
],
41+
},
42+
// layout包裹的带菜单的路由
1743
{
1844
path: "/article",
19-
component: "@/pages/article",
45+
component: "@/layouts/menuLayout",
2046
routes: [
2147
{ path: "/article/index", redirect: "/article/index" },
2248
{
@@ -26,19 +52,21 @@ export default defineConfig({
2652
],
2753
},
2854
],
29-
// copy: [{ from: "src/docs", to: "dist/docs" }],
55+
/**
56+
*
57+
* umi框架下public目录中的资源会直接复制到构建输出目录,所以这里不用再复制资源文件了
58+
*/
59+
// copy: [{ from: "src/xx", to: "dist/xxx" }],
3060
npmClient: "pnpm",
31-
// import componentsList from '@/componentsList';
32-
// console.log(componentsList); // 打印出所有组件文件的路径
33-
// chainWebpack(memo, { env }) {
34-
// memo.resolve.alias.set("@", path.resolve(__dirname, "src"));
35-
36-
// memo.plugin("get-directory-content").use(GetDirectoryContentPlugin, [
37-
// {
38-
// rootDir: process.cwd(),
39-
// directory: "src/components",
40-
// output: "dist/componentsList.js", // 输出结果到哪里
41-
// },
42-
// ]);
43-
// },
61+
chainWebpack: (memo) => {
62+
memo.plugin("mdFloderGeneratorPlugin").use(ScriptWebpackPlugin, [
63+
// { scriptPath: "./buildScript/generateDocsConfig.js" },
64+
{
65+
scriptPath: path.resolve(
66+
__dirname,
67+
"buildScript/generateDocsConfig.js"
68+
),
69+
},
70+
]);
71+
},
4472
});

buildScript/scriptWebpackPlugin.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class ScriptWebpackPlugin {
2+
constructor(options) {
3+
this.scriptPath = options.scriptPath;
4+
}
5+
6+
apply(compiler) {
7+
compiler.hooks.thisCompilation.tap("ScriptWebpackPlugin", (compilation) => {
8+
const scriptContent = require(this.scriptPath); // 假设这是一个模块化的脚本
9+
// 运行脚本逻辑...
10+
});
11+
}
12+
}
13+
14+
module.exports = ScriptWebpackPlugin;

docs/403.async.js

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/603.async.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/896.async.js

-32
This file was deleted.

docs/docs/business/test.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 测试文件
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# 特殊选择器::v-deep
2+
3+
::v-deep 是 Vue.js 中用于深度选择子组件内部元素的一个特殊选择器。在 Vue.js 的单文件组件(Single File Components, SFCs)中,样式通常是局部化的,这意味着它们只应用于当前组件。但有时,你可能需要为子组件中的元素应用样式,而这些子组件的样式作用域是封闭的,因此无法从父组件直接访问。
4+
::v-deep 允许你穿透这种封闭的作用域,直接为子组件内部的元素应用样式。这在某些情况下是非常有用的,比如当你需要覆盖第三方库或子组件的默认样式时。
5+
使用方法
6+
在 Vue.js 的 <style> 标签中使用 ::v-deep 选择器,可以穿透当前组件的作用域,并选中子组件内部的元素。例如:
7+
8+
```
9+
<template>
10+
<div>
11+
<ChildComponent />
12+
</div>
13+
</template>
14+
15+
<script>
16+
import ChildComponent from './ChildComponent.vue';
17+
18+
export default {
19+
components: {
20+
ChildComponent
21+
}
22+
};
23+
</script>
24+
25+
<style scoped>
26+
::v-deep .child-class {
27+
color: red;
28+
}
29+
</style>
30+
```
31+
32+
在上面的例子中,::v-deep .child-class 选择器将选中 ChildComponent 内部类名为 child-class 的元素,并为其应用红色字体样式。
33+
注意事项
34+
35+
使用 ::v-deep 时要谨慎,因为它会破坏组件的封装性。过度使用可能会导致样式难以管理和维护。
36+
::v-deep 是 Vue 3 中的新语法。在 Vue 2 中,你可以使用 >>> 或 /deep/ 来实现类似的功能。但请注意,这些老版本的语法在某些预处理器(如 Sass、Less)中可能无法正常工作。
37+
尽可能优先考虑通过组件的 props 和 events 来实现组件间的通信和样式定制,而不是直接使用 ::v-deep。这样更符合 Vue 的组件化设计原则。

docs/docsStructure.js

+17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ module.exports = [
88
"key": "docs/business/profit_review.md",
99
"label": "《盈利》作业",
1010
"type": "file"
11+
},
12+
{
13+
"key": "docs/business/test.md",
14+
"label": "测试文件",
15+
"type": "file"
1116
}
1217
]
1318
},
@@ -39,6 +44,18 @@ module.exports = [
3944
"label": "web",
4045
"type": "directory",
4146
"children": [
47+
{
48+
"key": "docs/develop/web/VUE",
49+
"label": "VUE",
50+
"type": "directory",
51+
"children": [
52+
{
53+
"key": "docs/develop/web/VUE/::-v-deep.md",
54+
"label": "特殊选择器::v-deep",
55+
"type": "file"
56+
}
57+
]
58+
},
4259
{
4360
"key": "docs/develop/web/react_markdown.md",
4461
"label": "在react中解析markdown文件",

docs/layouts__index.async.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/layouts__menuLayout.async.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/p__article__index.async.js

-1
This file was deleted.

docs/p__article__index.chunk.css

-1
This file was deleted.

docs/p__docs.async.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)