Skip to content

Commit 3bfd9aa

Browse files
committed
doc: lint
1 parent a902d3b commit 3bfd9aa

2 files changed

Lines changed: 41 additions & 25 deletions

File tree

.vitepress/components/sweep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ watchEffect(() => {
135135
border-color: var(--vp-c-brand-light);
136136
transition: all 0.1s ease-in-out;
137137
}
138-
.btn:dark {
138+
.btn.dark {
139139
background-color: var(--vp-c-brand-dark);
140140
border-color: var(--vp-c-brand-light);
141141
transition: all 0.1s ease-in-out;

4.WEB模块/4.2 Float的前端速通/4.2.3 现代前端技术栈/4.2.3.6 简单实操:使用 Vite+React+TypeScript+AntD 快速构建一个小应用.md renamed to 4.WEB模块/4.2 Float的前端速通/4.2.3 现代前端技术栈/4.2.3.6 简单实操:使用 Vite、React、TypeScript、AntD 快速构建一个小应用.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Visual Studio Code(简称 VSCode)是由微软开发的一款现代化、轻
66

77
VSCode 可以在 Windows、macOS 和 Linux 操作系统上运行,为开发者提供了一个统一的开发环境。
88

9-
[官网地址](https://code.visualstudio.com/)
9+
[官网地址](https://code.visualstudio.com/)
1010

1111
## Node.js 运行环境
1212

@@ -20,9 +20,9 @@ Node.js 提供了一个独立于浏览器的运行环境 (runtime environment)
2020
首先找个你想创建项目的文件夹,运行下面的命令,输入项目名称,选择 React 然后是 TypeScript。
2121

2222
``` bash
23-
$ npm create vite@latest
24-
```
23+
npm create vite@latest
2524

25+
```
2626

2727
## Ant Design 组件资源
2828

@@ -35,41 +35,52 @@ Ant Design 还提供了不少图标资源可以使用。
3535
安装:
3636

3737
``` bash
38-
$ npm install antd
38+
npm install antd
39+
3940
```
4041

4142
## 实操开始
4243

4344
**项目简介**:点击按钮次数加1,并可以用输入框改变标题。
4445

4546
**步骤**
47+
4648
1. **引入AntD组件**
4749

4850
将import的代码放在App.tsx的最上面
4951

50-
``` App.tsx
52+
::: code-group
53+
54+
``` tsx [App.tsx]
5155
import { Button } from "antd";
5256
import { Input } from "antd";
5357
import { Space } from 'antd';
5458
```
5559

60+
:::
61+
5662
2. **选择自己喜欢的按钮样式**
5763

5864
具体例子如下,可自行前往AntD官网学习。
5965

60-
``` App.tsx
61-
<Button color="primary" variant="solid">
62-
按钮一枚
63-
</Button>
66+
::: code-group
67+
68+
``` tsx [App.tsx]
69+
<Button color="primary" variant="solid">
70+
按钮一枚
71+
</Button>
6472
```
6573

74+
:::
75+
6676
3. **使用useState**
6777

6878
引入count和setCount并在按钮组件中使用onClick
6979

70-
``` App.tsx
80+
::: code-group
7181

72-
function App() {
82+
``` tsx [App.tsx]
83+
function App() {
7384
const [count, setCount] = useState(0)
7485

7586
return (
@@ -85,22 +96,30 @@ import { Space } from 'antd';
8596
}
8697
```
8798

99+
:::
100+
88101
4. **加入输入框**
89102

90103
将Input和Button放入Space之中,这三个都是AntD的组件。
91104

92-
``` App.tsx
93-
<Space.Compact style={{ width: '100%' }}>
94-
<Input placeholder="这是一个输入框"/>
95-
<Button color="primary" variant="solid"}>提交</Button>
96-
</Space.Compact>
105+
::: code-group
106+
107+
``` tsx [App.tsx]
108+
<Space.Compact style={{ width: '100%' }}>
109+
<Input placeholder="这是一个输入框" />
110+
<Button color="primary" variant="solid"> 提交 </Button>
111+
</Space.Compact>
112+
97113
```
98114

115+
:::
99116
5. **实现改标题功能**
100117

101118
下面是完整的代码
102119

103-
``` App.tsx
120+
::: code-group
121+
122+
``` tsx [App.tsx]
104123
import { useState } from 'react'
105124
import './App.css'
106125
import { Button } from "antd";
@@ -124,7 +143,6 @@ function App() {
124143
<Input placeholder="改标题" onChange={(e) => setNewTitle(e.target.value)}/>
125144
<Button color="primary" variant="solid" onClick={() => setBT((bt) => newTitle)}>提交</Button>
126145
</Space.Compact>
127-
128146
</>
129147
)
130148
}
@@ -133,13 +151,11 @@ export default App
133151

134152
```
135153

154+
:::
155+
136156
在终端里输入下面指令试试
137157

138158
``` bash
139-
$ npm run dev
140-
```
141-
142-
143-
144-
159+
npm run dev
145160

161+
```

0 commit comments

Comments
 (0)