-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from duenyang/develop
chore(docs): 优化使用文档
- Loading branch information
Showing
6 changed files
with
107 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: React 中使用 | ||
spline: explain | ||
isGettingStarted: true | ||
--- | ||
|
||
### 安装 | ||
|
||
```bash | ||
npm i tdesign-web-components | ||
``` | ||
|
||
### 使用 | ||
|
||
```javascript | ||
import 'tdesign-web-components/lib/style/index.css'; // 少量公共样式 | ||
import 'tdesign-web-components/lib/button'; | ||
|
||
const App = () => { | ||
const button = React.useRef(); | ||
const [theme, setTheme] = React.useState('success') | ||
|
||
const clickFn = () => { | ||
setTheme(theme === 'success' ? 'warning' : 'success'); | ||
} | ||
|
||
React.useEffect(() => { | ||
button.current.addEventListener('click', clickFn) | ||
return () => { | ||
button.current.removeEventListener('click', clickFn) | ||
} | ||
}, [theme]) | ||
|
||
return ( | ||
<t-button ref={button} theme={theme}></t-button> | ||
) | ||
} | ||
``` | ||
### 注意 | ||
|
||
props的key需要由`camelCase`写法,换为`hyphenate`,例如`abcDef`在使用时要设置为`abc-def` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Vue 中使用 | ||
spline: explain | ||
isGettingStarted: true | ||
--- | ||
|
||
### 安装 | ||
|
||
#### 使用 npm 安装 | ||
|
||
```bash | ||
npm i tdesign-web-components | ||
``` | ||
|
||
### 使用 | ||
|
||
```js | ||
import 'tdesign-web-components/lib/style/index.css'; // 少量公共样式 | ||
import 'tdesign-web-components/lib/button'; | ||
|
||
export default { | ||
name: 'App', | ||
setup() { | ||
const theme = ref('success') | ||
|
||
const clickFn = () => { | ||
theme.value === 'success' ? 'warning' : 'success' | ||
} | ||
|
||
return () => <t-button :theme={theme} @click="clickFn"></t-button> | ||
}, | ||
} | ||
``` | ||
|
||
### 注意 | ||
|
||
props的key需要由`camelCase`写法,换为`hyphenate`,例如`abcDef`在使用时要设置为`abc-def` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters