Skip to content
组件/表单组件引入于 1.2.0

EFolderPicker 目录选择 ​

import EUI 1.0

示例与代码 ​

选择工作目录 ​

文件夹选择涉及本机文件系统,请在 Gallery 中体验。

在 Gallery 中体验 ↗
QML 代码QML

设置初始目录 ​

文件夹选择涉及本机文件系统,请在 Gallery 中体验。

在 Gallery 中体验 ↗
QML 代码QML

禁用选择 ​

文件夹选择涉及本机文件系统,请在 Gallery 中体验。

在 Gallery 中体验 ↗
QML 代码QML

浏览 ​

文件夹选择涉及本机文件系统,请在 Gallery 中体验。

在 Gallery 中体验 ↗
QML 代码QML

打开文件 ​

文件夹选择涉及本机文件系统,请在 Gallery 中体验。

在 Gallery 中体验 ↗
QML 代码QML

属性 ​

属性说明取值与默认值
accessibleNamestring

辅助技术读取的名称;建议为无文字控件设置可读名称。

默认值placeholderText
appendComponentComponent

自定义输入附加区或列表尾部的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。

默认值
展开默认值
ETextButton { minHeight: 0 implicitWidth: 34 iconSource: EIcons.ELLIPSIS objectName: "filePickerBrowse" height: control.height accessibleName: EControlConfig.textFor(control, "PickerBrowse", ELocale.texts)  onClicked: control.open() }
clearIconint

组件使用的图标。

EIcons.*
0(无图标)

默认值EIcons.CIRCLE_XMARK
clearablebool

显示清除操作;评分中允许再次点击当前分数清零。

默认值true
dialogTitlestring

原生对话框标题与输入占位文字。

默认值
展开默认值
EControlConfig.textFor(control, mode === "save" ? "PickerSaveFile" : mode === "folder" ? "PickerSelectFolder" : "SelectFiles", ELocale.texts)
enabledbool

是否允许交互;false 时控件禁用。

默认值true
folderurl

对话框的初始目录 URL。

默认值""
fontfont

字体配置,控制字体、字号及文字样式。

常用字段:
family、pixelSize、pointSize
bold、italic、weight
underline、strikeout
letterSpacing、wordSpacing

默认值应用字体
formattervar

格式化回调,把当前值转换为显示文字。

默认值null
heightreal

组件尺寸,单位为像素;可绑定父布局尺寸。

默认值implicitHeight
modestring

选择模式:open 打开文件、save 选择保存位置、folder 选择目录。

open / save / folder

默认值"folder"
multiplebool

打开文件时允许多选;保存和目录模式仍为单选。

默认值false
nameFiltersvar

原生文件对话框的过滤器列表,例如 Text files (*.txt)。

默认值["All files (*)"]
parservar

输入解析函数,把显示文字转换为底层值。

默认值null
passwordVisiblebool

密码是否以明文显示。

默认值false
prefixComponentComponent

自定义前缀的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。

默认值null
prefixIconint

组件使用的图标。

EIcons.*
0(无图标)

默认值继承默认值
prependComponentComponent

自定义输入前置区的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。

默认值null
showPasswordbool

启用密码输入及密码显示切换。

默认值false
showWordLimitbool

显示当前字数与长度上限。

默认值false
sizeint

文字尺寸。

EStyle.Small
EStyle.Medium
EStyle.Large

默认值EControlConfig.sizeFor(control)
styleTypeint

语义配色风格。

EStyle.Default
EStyle.Primary
EStyle.Success
EStyle.Info
EStyle.Warning
EStyle.Danger

默认值EStyle.Primary
suffixComponentComponent

自定义后缀的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。

默认值null
suffixIconint

组件使用的图标。

EIcons.*
0(无图标)

默认值继承默认值
textColorcolor

文字颜色。

默认值
展开默认值
EPaletteManager.StatePalette.defaultTextColor( EPaletteManager.createStateObject(this, EStyle.TextColor) .setDark(ETheme.dark) .setEnabled(control.enabled) )
validateEventbool

值变化时是否向所属表单派发校验请求。

默认值true
validationMessagestring

校验结果说明或外部错误文字。

默认值""
validationStateint

输入校验状态。

EValidationState.None
EValidationState.Success
EValidationState.Warning
EValidationState.Error

默认值EValidationState.None
valuevar

当前选择;单选为文件 URL,多选为文件 URL 数组。

默认值""
visiblebool

是否显示组件。

默认值true
widthreal

组件尺寸,单位为像素;可绑定父布局尺寸。

默认值implicitWidth
dialogvar只读

延迟创建的原生对话框;创建前为 null。

字段:
alignCenter, draggable, overflow

默认值由运行时计算
hasValidationErrorbool只读

当前校验状态是否为 Error。

默认值由运行时计算
lastErrorstring只读

最近一次选择失败的原因代码;成功或清空后为空。

默认值由运行时计算
popupVisiblebool只读

原生选择对话框是否可见。

默认值由运行时计算
selectedUrlsvar只读

将当前选择统一转换为 URL 数组。

默认值由运行时计算
wordCountint只读

当前输入字符数量。

默认值由运行时计算
showPasswordStrengthbool

聚焦密码输入时显示强度与规则检查。

默认值false
passwordRulesvar

密码规则数组;每项包含 label 及 minLength 或 pattern。

默认值
展开默认值
[ {label: ELocale.texts.PasswordLength, minLength: 8}, {label: ELocale.texts.PasswordUppercase, pattern: /[A-Z]/}, {label: ELocale.texts.PasswordLowercase, pattern: /[a-z]/}, {label: ELocale.texts.PasswordNumber, pattern: /[0-9]/}, {label: ELocale.texts.PasswordSymbol, pattern: /[^A-Za-z0-9]/} ]
passwordStrengthreal只读

通过规则的比例,范围为 0 到 1。

默认值
展开默认值
passwordRequirements.length ? passwordRequirements.filter(function(rule) { return rule.passed }).length / passwordRequirements.length : 0
passwordRequirementsvar只读

包含 label 与 passed 的规则检查结果。

默认值
展开默认值
Array.isArray(passwordRules) ? passwordRules.map(function(rule) { let passed = false try { if (rule && rule.minLength !== undefined) passed = text.length >= Number(rule.minLength) else if (rule && rule.pattern) { const expression = new RegExp(rule.pattern) passed = expression.test(text) } } catch (error) { passed = false } return {label: rule && rule.label ? String(rule.label) : "", passed: passed} }) : []

信号 ​

签名作用
cleared()

使用清空操作清除内容后触发。

formatFailed(string message)

输入格式化失败时触发,message 为失败原因。

rejected()

用户取消文件选择时触发。

picked(var value)

选定值后触发,value 为选中的值。

selectionRejected(string reason)

所选路径不符合限制时触发,reason 为拒绝原因。

方法 ​

签名作用
close()

关闭组件的面板或弹窗。

clear()

清空组件当前内容或选择。

open()

打开组件的面板或弹窗。

基于 MIT 许可发布 · 第三方资源遵循其各自许可