跳到正文

FaInputDialogPage 弹窗分页选择器 ​

使用只读输入框打开带分页 FaTable 的选择 Dialog,支持单选、双击确认、清空、标签回显和表格列插槽。

弹窗分页表格选择器

可操作示例
查看代码
Vue
<template>
	<div class="demo-stack">
		<FaInputDialogPage
			v-model="value"
			v-model:label="label"
			:request-api="requestApi"
			row-key="id"
			label-key="name"
			title="选择 Fast 项目"
			placeholder="请选择项目"
			@change="changedData = $event"
		>
			<FaTableColumn prop="name" label="项目" min-width="180" />
			<FaTableColumn prop="owner" label="团队" width="120" />
			<FaTableColumn prop="status" label="状态" width="100" />
		</FaInputDialogPage>
		<span class="demo-value">当前项目:{{ label ?? "未选择" }}({{ value ?? "—" }});change 数据:{{ JSON.stringify(changedData) }}</span>
	</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import type { PagedInput, PagedResult } from "fast-element-plus";

const value = ref<number | null>(2);
const label = ref<string | null>("Fast.Element.Plus");
const changedData = ref<unknown>();
const rows = [
	{ id: 1, name: "Fast.NET", owner: "SDK 团队", status: "稳定" },
	{ id: 2, name: "Fast.Element.Plus", owner: "前端团队", status: "开发中" },
	{ id: 3, name: "Fast.Admin", owner: "业务团队", status: "稳定" },
];

const requestApi = (_input?: PagedInput): Promise<PagedResult<Record<string, unknown>>> =>
	Promise.resolve({
		pageIndex: 1,
		pageSize: 20,
		totalRows: rows.length,
		rows,
	});
</script>

FaInputDialogPage 完整 API

Props 属性

属性来源说明类型默认值
rowKeyFast 新增行或节点唯一键。String / Functionid
modelValueFast 新增v-model 绑定值。String / Number—
labelFast 新增显示文本或同步标签值。String—
placeholderFast 新增占位提示。String请选择
disabledFast 新增是否禁用组件或当前选项。Booleanfalse
titleFast 新增组件标题文本。String—
requestApiFast 新增异步数据请求函数。Function—
initParamFast 新增请求初始化参数。String / Number / Object—
labelKeyFast 新增选中行的标签字段。Stringname

Events 事件

名称来源说明参数 / 类型
update:modelValueFast 新增更新 v-model。—
update:labelFast 新增更新标签绑定值。—
changeFast 新增值或选择发生变化。—

Slots 插槽

名称来源说明参数 / 类型
default(FaTableColumn)Fast 新增声明弹窗选择表格使用的 FaTableColumn。(FaTableColumn)

实例成员

名称来源说明参数 / 类型
selectionRowFast 新增弹窗分页选择器当前选中的行。—
openFast 新增执行 Fast 异步打开流程。—
clearFast 新增清空当前选择值。—

FaInputDialogPage 实例方法 ​

以下代码为调用片段。行、选项和字段应对应实际数据。

open 打开 ​

打开选择器弹窗

签名 ​

ts
open(): Promise<void>;

示例 ​

vue
<template>
	<FaInputDialogPage ref="componentRef" />
	<button type="button" @click="handleExample">调用方法</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaInputDialogPage } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaInputDialogPage>>();
async function handleExample() {
	const result = await componentRef.value?.open();
	console.log(result);
}
</script>

输入 ​

该方法没有输入参数。

返回 ​

返回值返回值类型返回值说明
resultPromise<void>异步完成后的结果;Promise 拒绝时由调用方处理。

clear 清空 ​

清除选择

签名 ​

ts
clear(): void;

示例 ​

vue
<template>
	<FaInputDialogPage ref="componentRef" />
	<button type="button" @click="handleExample">调用方法</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaInputDialogPage } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaInputDialogPage>>();
function handleExample() {
	componentRef.value?.clear();
}
</script>

输入: 无参数。

返回: void。