diff --git a/packages/uni-components/src/vue/input/index.tsx b/packages/uni-components/src/vue/input/index.tsx index 670da0c14c58993e38dd99a5c631cc7dfd4d52cd..f284a795750c1cdd5992a5d66bbfbb27dec9cb43 100644 --- a/packages/uni-components/src/vue/input/index.tsx +++ b/packages/uni-components/src/vue/input/index.tsx @@ -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 diff --git a/packages/uni-components/src/vue/textarea/index.tsx b/packages/uni-components/src/vue/textarea/index.tsx index 15c450ff185fb14d4a7d4aadd3b68e1a4af8eb58..c2c8abf5f516242178440d7d706153daa089c4e2 100644 --- a/packages/uni-components/src/vue/textarea/index.tsx +++ b/packages/uni-components/src/vue/textarea/index.tsx @@ -56,7 +56,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({ class: UniTextareaElement, }, //#endif - setup(props, { emit }) { + setup(props, { emit, expose }) { const rootRef: Ref = ref(null) const wrapperRef: Ref = 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 diff --git a/packages/uni-h5/dist-x/uni-h5.cjs.js b/packages/uni-h5/dist-x/uni-h5.cjs.js index 4d5eb4aa8c19fdaac479060120f9fe77c22a0ebb..016b3871209edb24fc16639df0723db395ce0132 100644 --- a/packages/uni-h5/dist-x/uni-h5.cjs.js +++ b/packages/uni-h5/dist-x/uni-h5.cjs.js @@ -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", diff --git a/packages/uni-h5/dist-x/uni-h5.es.js b/packages/uni-h5/dist-x/uni-h5.es.js index dfdf4f0d81e64b62dc96aa20e0562402b9ed0e5e..fdbeec3e88389a46d335c7feb556b90663d7851f 100644 --- a/packages/uni-h5/dist-x/uni-h5.es.js +++ b/packages/uni-h5/dist-x/uni-h5.es.js @@ -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", { diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index e7d4fd0d15f2e00adacde8496070628d6fd0536b..81882a46baef2be9aed39fd72183e2616e377e72 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -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", diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 2edad46d3f24a8a6aca2d59c20470a781408a9d8..5fe30129d201a1281483c77cbf2900554ea26733 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -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",