prompt
安装
import Vue from 'vue'
import { $prompt } from 'veui'
Vue.use($prompt)
API
该插件在安装后会在所有组件实例上提供 $prompt
方法,类型为 function(content, title, options): Promise<?string>
。
该方法返回 Promise
对象,会在弹框成功关闭后被 resolve。如果用户点击了“确定”按钮,resolve 结果为用户输入的字符串;如果点击了“取消”按钮,结果值就为 null
。
参数名 | 类型 | 说明 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
content | string | 显示在输入弹框中的文本内容。 | ||||||||||||
title | string | 输入弹框的标题。 | ||||||||||||
options | Object |
| ||||||||||||
okLabel | string | “确定”按钮的文字内容。 | ||||||||||||
cancelLabel | string | “取消”按钮的文字内容。 |