antd-mini
Version:
antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。
216 lines (184 loc) • 5.73 kB
Markdown
---
nav:
path: /copilot
group:
title: Wake
order: 2
toc: 'content'
---
It is used to allow users who are exposed to AI products for the first time to quickly understand what AI can do, and can clearly convey to users the scope of intent and expected functions that AI can achieve. The use of appropriate welcome recommend components can effectively reduce user learning costs, allowing users to quickly understand and start smoothly.
In `index.json` Introducing Components in
```json
"usingComponents": {
"ant-prompts": "antd-mini/es/Prompts/index"
"ant-prompts": "antd-mini/Prompts/index"
}
```
```xml
<ant-prompts
items="{{baseList}}"
title="{{promptsTitle}}"
onItemTap="onItemTap"
binditemtap="onItemTap"
/>
```
```js
Page({
data: {
promptsTitle: '我可以帮您:',
baseList: [
{
title: 'Ant Design X 全新升级了什么?',
},
{
title: 'Ant Design X 组件资产内容',
},
{
title: '快速实现安装和Introduction组件',
},
],
},
onItemTap(item) {
let item = i;
my.alert({
content: `点击了 ${item.title || ''} ${item.content || ''}`,
});
item = i.detail;
wx.showToast({ title: `点击了 ${item.title || ''} ${item.content || ''}` });
},
});
```
```xml
<ant-prompts
items="{{ arrowList }}"
title="{{ promptsTitle }}"
/>
```
```js
Page({
data: {
promptsTitle: '我可以帮您:',
arrowList: [
{
showArrow: true,
title: '热门话题:',
image:
'https://mdn.alipayobjects.com/huamei_upibrs/afts/img/A*wJ5aRpr2q1wAAAAAAAAAAAAADkx8AQ/original',
content: 'Ant Design X 全新升级',
},
{
showArrow: true,
title: '组件查询:',
image:
'https://mdn.alipayobjects.com/huamei_upibrs/afts/img/A*R9L1RLo4x58AAAAAAAAAAAAADkx8AQ/original',
content: '欢迎组件',
},
{
showArrow: true,
title: '新手帮助:',
image:
'https://mdn.alipayobjects.com/huamei_upibrs/afts/img/A*7eRqQ4JpdccAAAAAAAAAAAAADkx8AQ/original',
content: '如何实现快速安装和Introduction',
},
],
},
});
```
```xml
<ant-prompts
items="{{ styleList }}"
className="customizeStyle"
title="{{ promptsTitle }}"
/>
```
```css
.customizeStyle .ant-copilot-prompts-list-item-content {
font-family: PingFangSC-Light;
font-size: 28rpx;
color: rgba(0, 0, 0, 0.45);
line-height: 44rpx;
}
```
```xml
<ant-prompts items="{{ arrowList }}">
<view slot="prompts-title" class="customize-prompts-title">
Custom prompt title:
</view>
</ant-prompts>
```
```xml
<ant-prompts items="{{ baseList }}">
<view slot="prompts-item" slot-scope="props" class="customize-prompts-item">
Custom prompt items :{{ props.item.title}}
</view>
</ant-prompts>
```
```xml
<ant-prompts
title="超长滑动"
items="{{ horizontalList }}"
vertical="{{false}}"
/>
<ant-prompts
title="超长换行"
items="{{ horizontalList }}"
vertical="{{false}}"
wrap
/>
<ant-prompts
title="自定义"
items="{{ horizontalList }}"
vertical="{{false}}"
wrap
>
<view slot="prompts-item" slot-scope="props">Custom:{{ props.item.label}}</view>
</ant-prompts>
```
<code src='../../copilot-demo/pages/Prompts/index'></code>
The following table describes the API properties for Prompts components:
| Property | Description | Type | Default Value |
| ---------------------- | -------------------- | --------------------------------------------------------- | ------ |
| className | Class Name | string | - |
| items | Prompt Items | [PromptsItem](
| title | Prompt Title | string | - |
| vertical | Under horizontal layout, automatic line wrap | boolean | true |
| wrap | Class Name | boolean | false |
|
|
| Property | Description | Type | Default Value |
| ----------- | ---------------------------------------- | ------- | ------ |
| key | Unique identification is used to distinguish each prompt item | string | - |
| icon | The icon image link in front supports incoming antd-icon. | string | - |
| label | The prompt label displays the main content of the prompt | string | - |
| description | Prompt description provides additional information | string | - |
| showArrow | Prompt whether to show the right arrow | boolean | - |
| Slot Name | Description |
| ------------- | -------------- |
| prompts-title | Title of Prompt Item |
| prompts-item | Prompt Subkey |