Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
047e4aca
U
uni-app
项目概览
DCloud
/
uni-app
6 个月 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
047e4aca
编写于
2月 21, 2024
作者:
W
wangjinxin613
提交者:
DCloud-WZF
2月 28, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(uni-app): input、textarea 组件暴露 $triggerInput 方法
上级
3bb5f11d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
90 addition
and
10 deletion
+90
-10
packages/uni-components/src/vue/input/index.tsx
packages/uni-components/src/vue/input/index.tsx
+9
-1
packages/uni-components/src/vue/textarea/index.tsx
packages/uni-components/src/vue/textarea/index.tsx
+9
-1
packages/uni-h5/dist-x/uni-h5.cjs.js
packages/uni-h5/dist-x/uni-h5.cjs.js
+18
-2
packages/uni-h5/dist-x/uni-h5.es.js
packages/uni-h5/dist-x/uni-h5.es.js
+18
-2
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+18
-2
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+18
-2
未找到文件。
packages/uni-components/src/vue/input/index.tsx
浏览文件 @
047e4aca
...
...
@@ -35,7 +35,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
class
:
UniInputElement
,
},
//#endif
setup
(
props
,
{
emit
})
{
setup
(
props
,
{
emit
,
expose
})
{
const
INPUT_TYPES
=
[
'
text
'
,
'
number
'
,
'
idcard
'
,
'
digit
'
,
'
password
'
,
'
tel
'
]
const
AUTOCOMPLETES
=
[
'
off
'
,
'
one-time-code
'
]
const
type
=
computed
(()
=>
{
...
...
@@ -171,6 +171,14 @@ export default /*#__PURE__*/ defineBuiltInComponent({
!
props
.
confirmHold
&&
input
.
blur
()
}
expose
({
$triggerInput
:
(
detail
:
{
value
:
string
})
=>
{
emit
(
'
update:modelValue
'
,
detail
.
value
)
emit
(
'
update:value
'
,
detail
.
value
)
state
.
value
=
detail
.
value
},
})
//#if _X_ && !_NODE_JS_
onMounted
(()
=>
{
const
rootElement
=
rootRef
.
value
as
UniInputElement
...
...
packages/uni-components/src/vue/textarea/index.tsx
浏览文件 @
047e4aca
...
...
@@ -56,7 +56,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
class
:
UniTextareaElement
,
},
//#endif
setup
(
props
,
{
emit
})
{
setup
(
props
,
{
emit
,
expose
})
{
const
rootRef
:
Ref
<
HTMLElement
|
null
>
=
ref
(
null
)
const
wrapperRef
:
Ref
<
HTMLElement
|
null
>
=
ref
(
null
)
const
{
fieldRef
,
state
,
scopedAttrsState
,
fixDisabledColor
,
trigger
}
=
...
...
@@ -124,6 +124,14 @@ export default /*#__PURE__*/ defineBuiltInComponent({
setFixMargin
()
}
expose
({
$triggerInput
:
(
detail
:
{
value
:
string
})
=>
{
emit
(
'
update:modelValue
'
,
detail
.
value
)
emit
(
'
update:value
'
,
detail
.
value
)
state
.
value
=
detail
.
value
},
})
//#if _X_ && !_NODE_JS_
onMounted
(()
=>
{
const
rootElement
=
rootRef
.
value
as
UniTextareaElement
...
...
packages/uni-h5/dist-x/uni-h5.cjs.js
浏览文件 @
047e4aca
...
...
@@ -3561,7 +3561,8 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
props
:
props$j
,
emits
:
[
"
confirm
"
,
...
emit
],
setup
(
props2
,
{
emit
:
emit2
emit
:
emit2
,
expose
})
{
const
INPUT_TYPES
=
[
"
text
"
,
"
number
"
,
"
idcard
"
,
"
digit
"
,
"
password
"
,
"
tel
"
];
const
AUTOCOMPLETES
=
[
"
off
"
,
"
one-time-code
"
];
...
...
@@ -3664,6 +3665,13 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
});
!
props2
.
confirmHold
&&
input
.
blur
();
}
expose
({
$triggerInput
:
(
detail
)
=>
{
emit2
(
"
update:modelValue
"
,
detail
.
value
);
emit2
(
"
update:value
"
,
detail
.
value
);
state
.
value
=
detail
.
value
;
}
});
return
()
=>
{
let
inputNode
=
props2
.
disabled
&&
fixDisabledColor
?
vue
.
createVNode
(
"
input
"
,
{
"
key
"
:
"
disabled-input
"
,
...
...
@@ -7361,7 +7369,8 @@ const index$h = /* @__PURE__ */ defineBuiltInComponent({
props
:
props$a
,
emits
:
[
"
confirm
"
,
"
linechange
"
,
...
emit
],
setup
(
props2
,
{
emit
:
emit2
emit
:
emit2
,
expose
})
{
const
rootRef
=
vue
.
ref
(
null
);
const
wrapperRef
=
vue
.
ref
(
null
);
...
...
@@ -7423,6 +7432,13 @@ const index$h = /* @__PURE__ */ defineBuiltInComponent({
!
props2
.
confirmHold
&&
textarea
.
blur
();
}
}
expose
({
$triggerInput
:
(
detail
)
=>
{
emit2
(
"
update:modelValue
"
,
detail
.
value
);
emit2
(
"
update:value
"
,
detail
.
value
);
state
.
value
=
detail
.
value
;
}
});
return
()
=>
{
let
textareaNode
=
props2
.
disabled
&&
fixDisabledColor
?
vue
.
createVNode
(
"
textarea
"
,
{
"
key
"
:
"
disabled-textarea
"
,
...
...
packages/uni-h5/dist-x/uni-h5.es.js
浏览文件 @
047e4aca
...
...
@@ -9754,7 +9754,8 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
class: UniInputElement
},
setup(props2, {
emit: emit2
emit: emit2,
expose
}) {
const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
const AUTOCOMPLETES = ["off", "one-time-code"];
...
...
@@ -9857,6 +9858,13 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
});
!props2.confirmHold && input.blur();
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state2.value = detail.value;
}
});
onMounted(() => {
const rootElement = rootRef.value;
Object.defineProperty(rootElement, "value", {
...
...
@@ -15238,7 +15246,8 @@ const index$i = /* @__PURE__ */ defineBuiltInComponent({
class: UniTextareaElement
},
setup(props2, {
emit: emit2
emit: emit2,
expose
}) {
const rootRef = ref(null);
const wrapperRef = ref(null);
...
...
@@ -15303,6 +15312,13 @@ const index$i = /* @__PURE__ */ defineBuiltInComponent({
{
setFixMargin();
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state2.value = detail.value;
}
});
onMounted(() => {
const rootElement = rootRef.value;
Object.defineProperty(rootElement, "value", {
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
047e4aca
...
...
@@ -3504,7 +3504,8 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
props
:
props$j
,
emits
:
[
"
confirm
"
,
...
emit
],
setup
(
props2
,
{
emit
:
emit2
emit
:
emit2
,
expose
})
{
const
INPUT_TYPES
=
[
"
text
"
,
"
number
"
,
"
idcard
"
,
"
digit
"
,
"
password
"
,
"
tel
"
];
const
AUTOCOMPLETES
=
[
"
off
"
,
"
one-time-code
"
];
...
...
@@ -3607,6 +3608,13 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
});
!
props2
.
confirmHold
&&
input
.
blur
();
}
expose
({
$triggerInput
:
(
detail
)
=>
{
emit2
(
"
update:modelValue
"
,
detail
.
value
);
emit2
(
"
update:value
"
,
detail
.
value
);
state
.
value
=
detail
.
value
;
}
});
return
()
=>
{
let
inputNode
=
props2
.
disabled
&&
fixDisabledColor
?
vue
.
createVNode
(
"
input
"
,
{
"
key
"
:
"
disabled-input
"
,
...
...
@@ -7288,7 +7296,8 @@ const index$g = /* @__PURE__ */ defineBuiltInComponent({
props
:
props$a
,
emits
:
[
"
confirm
"
,
"
linechange
"
,
...
emit
],
setup
(
props2
,
{
emit
:
emit2
emit
:
emit2
,
expose
})
{
const
rootRef
=
vue
.
ref
(
null
);
const
wrapperRef
=
vue
.
ref
(
null
);
...
...
@@ -7350,6 +7359,13 @@ const index$g = /* @__PURE__ */ defineBuiltInComponent({
!
props2
.
confirmHold
&&
textarea
.
blur
();
}
}
expose
({
$triggerInput
:
(
detail
)
=>
{
emit2
(
"
update:modelValue
"
,
detail
.
value
);
emit2
(
"
update:value
"
,
detail
.
value
);
state
.
value
=
detail
.
value
;
}
});
return
()
=>
{
let
textareaNode
=
props2
.
disabled
&&
fixDisabledColor
?
vue
.
createVNode
(
"
textarea
"
,
{
"
key
"
:
"
disabled-textarea
"
,
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
047e4aca
...
...
@@ -9681,7 +9681,8 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
props: props$q,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
emit: emit2,
expose
}) {
const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
const AUTOCOMPLETES = ["off", "one-time-code"];
...
...
@@ -9784,6 +9785,13 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
});
!props2.confirmHold && input.blur();
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state2.value = detail.value;
}
});
return () => {
let inputNode = props2.disabled && fixDisabledColor ? createVNode("input", {
"key": "disabled-input",
...
...
@@ -14883,7 +14891,8 @@ const index$h = /* @__PURE__ */ defineBuiltInComponent({
props: props$h,
emits: ["confirm", "linechange", ...emit],
setup(props2, {
emit: emit2
emit: emit2,
expose
}) {
const rootRef = ref(null);
const wrapperRef = ref(null);
...
...
@@ -14948,6 +14957,13 @@ const index$h = /* @__PURE__ */ defineBuiltInComponent({
{
setFixMargin();
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state2.value = detail.value;
}
});
return () => {
let textareaNode = props2.disabled && fixDisabledColor ? createVNode("textarea", {
"key": "disabled-textarea",
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录