提交 712912a7 编写于 作者: O oasis-cloud

feat: configprovider组件增加文档和多语言

上级 eb746eca
......@@ -18,9 +18,9 @@
"show": true
},
{
"name": "international",
"name": "international-react",
"cName": "国际化",
"show": false
"show": true
},
{
"name": "resource",
......@@ -100,6 +100,17 @@
"show": true,
"desc": "弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示",
"author": "szg2008"
},
{
"version": "1.0.0",
"name": "ConfigProvider",
"type": "component",
"cName": "全局配置组件",
"desc": "可以配置多语言等全局属性",
"sort": 16,
"show": true,
"exportEmpty": true,
"author": "hanyuxinting"
}
]
},
......@@ -678,17 +689,6 @@
"show": true,
"author": "liukun"
},
{
"version": "1.0.0",
"name": "ConfigProvider",
"type": "component",
"cName": "全局配置组件",
"desc": "可以配置多语言等全局属性",
"sort": 16,
"show": false,
"exportEmpty": true,
"author": "hanyuxinting"
},
{
"version": "1.0.0",
"name": "VirtualList",
......
import React from 'react'
import { ConfigProvider } from './configprovider'
import TextArea from '../textarea'
import Input from '../input'
import enUS from '../../locales/en-US'
import zhCN from '../../locales/zh-CN'
import zhTW from '../../locales/zh-TW'
......@@ -10,25 +9,21 @@ const ConfigProviderDemo = () => {
return (
<>
<div className="demo">
<h2>Textarea 默认</h2>
<ConfigProvider>
<TextArea disabled limitshow maxlength="20" />
</ConfigProvider>
<h2>Textarea 英文</h2>
<ConfigProvider locale={enUS}>
<TextArea disabled limitshow maxlength="20" />
<Input label="Input 文本(异步)" focus={focus} blur={blur} />
</ConfigProvider>
<h2>Textarea 中文</h2>
<ConfigProvider locale={zhCN}>
<TextArea disabled limitshow maxlength="20" />
<Input label="Input 文本(异步)" focus={focus} blur={blur} />
</ConfigProvider>
<h2>Textarea 繁体中文</h2>
<ConfigProvider locale={zhTW}>
<TextArea disabled limitshow maxlength="20" />
<Input label="Input 文本(异步)" focus={focus} blur={blur} />
</ConfigProvider>
<h2>Textarea 默认</h2>
<ConfigProvider>
<TextArea disabled limitshow maxlength="20" />
<Input label="Input 文本(异步)" focus={focus} blur={blur} />
</ConfigProvider>
</div>
</>
......
# ConfigProvider组件
# ConfigProvider
### 介绍
### Introduce
基于 xxxxxxx
Used to configure NutUI-React components globally, providing internationalization support.
### 安装
### Install
``` javascript
import { ConfigProvider } from '@nutui/nutui-react';
```
## Demo
## 代码演示
:::demo
### 基础用法1
```tsx
import React from 'react';
import { ConfigProvider, Textarea } from "@nutui/nutui-react";
import en from "@nutui/nutui-react/dist/locales/en-US";
const App = () => {
return (
<ConfigProvider locale={en}>
<Textarea />
</ConfigProvider>
)
}
export default App;
```
:::
## API
### Props
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------------------------|--------|------------------|
| name | 图标名称或图片链接 | String | - |
| color | 图标颜色 | String | - |
| size | 图标大小,如 '20px' '2em' '2rem' | String | - |
| class-prefix | 类名前缀,用于使用自定义图标 | String | 'nutui-iconfont' |
| tag | HTML 标签 | String | 'i' |
### Events
| 事件名 | 说明 | 回调参数 |
|--------|----------------|--------------|
| click | 点击图标时触发 | event: Event |
| Props | Description | Type | Default |
|--------------|----------------------------|--------|-----------------|
| locale | Set up multilingual packs | BaseLang | zhCN |
# ConfigProvider组件
# ConfigProvider 全局配置
### 介绍
基于 xxxxxxx
用于全局配置 NutUI-React 组件,提供国际化支持。
### 安装
``` javascript
import { ConfigProvider } from '@nutui/nutui-react';
```
## 代码演示
### 基础用法1
### 基础用法
:::demo
```tsx
import React from 'react';
import { ConfigProvider, Textarea } from "@nutui/nutui-react";
import en from "@nutui/nutui-react/dist/locales/en-US";
## API
const App = () => {
return (
<ConfigProvider locale={en}>
<Textarea />
</ConfigProvider>
)
}
### Props
export default App;
```
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------------------------|--------|------------------|
| name | 图标名称或图片链接 | String | - |
| color | 图标颜色 | String | - |
| size | 图标大小,如 '20px' '2em' '2rem' | String | - |
| class-prefix | 类名前缀,用于使用自定义图标 | String | 'nutui-iconfont' |
| tag | HTML 标签 | String | 'i' |
:::
### Events
## API
### Props
| 事件名 | 说明 | 回调参数 |
|--------|----------------|--------------|
| click | 点击图标时触发 | event: Event |
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------------------|--------|-----------------|
| locale | 设置多语言包 | BaseLang | zhCN |
# ConfigProvider组件
# ConfigProvider 全域配置
### 介
### 介
基于 xxxxxxx
用於全域配置 NutUI-React 元件,提供國際化支援。
### 安
### 安
``` javascript
import { ConfigProvider } from '@nutui/nutui-react';
```
## 代碼演示
## 代码演示
### 基礎用法
### 基础用法1
:::demo
```tsx
import React from 'react';
import { ConfigProvider, Textarea } from "@nutui/nutui-react";
import en from "@nutui/nutui-react/dist/locales/en-US";
const App = () => {
return (
<ConfigProvider locale={en}>
<Textarea />
</ConfigProvider>
)
}
## API
export default App;
```
### Props
:::
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------------------------|--------|------------------|
| name | 图标名称或图片链接 | String | - |
| color | 图标颜色 | String | - |
| size | 图标大小,如 '20px' '2em' '2rem' | String | - |
| class-prefix | 类名前缀,用于使用自定义图标 | String | 'nutui-iconfont' |
| tag | HTML 标签 | String | 'i' |
## API
### Events
### Props
| 事件名 | 说明 | 回调参数 |
|--------|----------------|--------------|
| click | 点击图标时触发 | event: Event |
| 屬性 | 說明 | 類型 | 預設值 |
|--------------|----------------------------|--------|-----------------|
| locale | 設置多語言包 | BaseLang | zhCN |
......@@ -43,14 +43,14 @@ const WithNavRouter = (C: LoadableComponent<any>) => {
}
location.href = href
}
const pathNames = props.location.pathname.split('/')
return (
<>
<div id="nav">
<div className="back" onClick={() => window.parent.history.back()}>
<Icon name="left"></Icon>
</div>
{props.location.pathname.replace('/', '')}
{pathNames[pathNames.length - 1]}
<div className="translate" onClick={() => handleSwitchLocale()}>
<Icon name="https://img14.360buyimg.com/imagetools/jfs/t1/135168/8/21387/6193/625fa81aEe07cc347/55ad5bc2580c53a6.png"></Icon>
</div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册