docs: 文档中错误的引入路径修复 (#4751)

This commit is contained in:
RUNZE LU 2022-06-30 20:47:34 +08:00 committed by GitHub
parent 28f936078d
commit a0f6abc057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View File

@ -1652,8 +1652,8 @@ import {
ListenerContext,
registerAction,
RendererAction
} from 'amis/lib/actions';
import {RendererEvent} from 'amis/lib/utils/renderer-event';
} from 'amis-core';
import {RendererEvent} from 'amis-core';
// 动作定义
interface IMyAction extends ListenerAction {

View File

@ -56,9 +56,9 @@ amis 主要代码在 `src` 和 `scss` 目录下,这里主要介绍 `src` 下
```tsx
import React from 'react';
import {Renderer, RendererProps} from '../factory';
import {Renderer, RendererProps} from 'amis-core';
import {BaseSchema} from '../Schema';
import {resolveVariable, resolveVariableAndFilter} from '../utils/tpl-builtin';
import {resolveVariable, resolveVariableAndFilter} from 'amis-core';
// schema 是用来给编辑器提示用的,同时也作为组件 props 的类型定义
export interface AvatarSchema extends BaseSchema {

View File

@ -81,7 +81,7 @@ let amisScoped = amis.embed(
React 版本中没有内置英文翻译,需要自己 import使用如下方法
```javascript
import 'amis/lib/locale/en-US';
import 'amis-ui/lib/locale/en-US';
```
在渲染 amis 组件的时候设置 locale 为 en-US

View File

@ -48,7 +48,7 @@ Page 组件的示例代码
```jsx
import * as React from 'react';
import {Renderer} from 'amis';
import {Renderer} from 'amis-core';
@Renderer({
type: 'page'

View File

@ -82,7 +82,7 @@ let amisScoped = amis.embed('#root', {
在 React 环境下使用 amis还可以直接引入 amis 内置组件,在 amis 项目源码 `src/components` 下的组件都是标准 React 组件,可以在项目中直接引用,这样就能将 amis 当成纯粹 UI 库来使用。
```jsx
import {Button} from 'amis/lib/components/index';
import {Button} from 'amis-ui';
...

View File

@ -388,9 +388,8 @@ import * as React from 'react';
import axios from 'axios';
import copy from 'copy-to-clipboard';
import {render as renderAmis, ToastComponent, AlertComponent} from 'amis';
import {alert, confirm} from 'amis/lib/components/Alert';
import {toast} from 'amis/lib/components/Toast';
import {render as renderAmis} from 'amis';
import {ToastComponent, AlertComponent, alert, confirm, toast} from 'amis-ui';
class MyComponent extends React.Component<any, any> {
render() {
@ -594,7 +593,7 @@ render 有三个参数,后面会详细说明这三个参数内的属性
#### confirm
```ts
(msg: string) => boolean | Promise<boolean>
(msg: string) => boolean | Promise<boolean>;
```
用来实现确认框。返回 boolean 值
@ -662,7 +661,7 @@ render 有三个参数,后面会详细说明这三个参数内的属性
#### loadRenderer
```ts
(schema: any, path: string) => Promise<Function>
(schema: any, path: string) => Promise<Function>;
```
可以通过它懒加载自定义组件,比如: https://github.com/baidu/amis/blob/master/__tests__/factory.test.tsx#L64-L91。