Prompts 推荐提示词
用于开屏引导问题或回答后的下一步追问建议。
基础用法
推荐提问
<script setup>
import { ref } from 'vue'
import Prompts from '@/vue/components/Prompts.vue'
const selected = ref('')
const items = [
{ key: '1', label: '写一个 TypeScript 防抖函数', icon: 'code' },
{ key: '2', label: '解释 Vue3 响应式原理', icon: 'bolt' },
{ key: '3', label: '生成单元测试用例', icon: 'vial' }
]
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 12px;">
<Prompts
title="推荐提问"
:items="items"
layout="horizontal"
variant="pill"
@select="(item) => (selected = item.label)"
/>
<div v-if="selected" style="font-size: 13px; color: var(--vk-text-color-secondary);">
已选择:{{ selected }}
</div>
</div>
</template>API
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 分组标题 | string | — |
| items | 提示词条目列表 | PromptItem[] | [] |
| layout | 排列布局 | 'grid' | 'horizontal' | 'vertical' | 'grid' |
| variant | 卡片形态 | 'card' | 'pill' | 'card' |
| wrap | 是否自动换行 | boolean | true |
