提交 bb965192 编写于 作者: D DCloud_LXH

fix(input): AutoFocus Missing FOCUS event

上级 9ca91daf
......@@ -16,7 +16,7 @@ const props = /*#__PURE__*/ Object.assign({}, fieldProps, {
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Input',
props,
emit: ['confirm', ...fieldEmit],
emits: ['confirm', ...fieldEmit],
setup(props, { emit }) {
const INPUT_TYPES = ['text', 'number', 'idcard', 'digit', 'password']
const type = computed(() => {
......
......@@ -7,6 +7,7 @@ import {
onBeforeMount,
computed,
reactive,
nextTick,
} from 'vue'
import { debounce } from '@dcloudio/uni-shared'
import { throttle } from './throttle'
......@@ -149,6 +150,7 @@ export const emit = [
'blur',
'update:value',
'update:modelValue',
'update:focus',
...keyboardEmit,
]
......@@ -296,7 +298,8 @@ function useAutoFocus(props: Props, fieldRef: Ref<HTMLFieldElement | null>) {
onMounted(() => {
startTime = startTime || Date.now()
if (needFocus.value) {
focus()
// nextTick 为了保证逻辑在initField之后执行
nextTick(focus)
}
})
}
......
......@@ -2834,6 +2834,7 @@ const emit = [
"blur",
"update:value",
"update:modelValue",
"update:focus",
...emit$1
];
function useBase(props2, rootRef, emit2) {
......@@ -3022,7 +3023,7 @@ const props$k = /* @__PURE__ */ Object.assign({}, props$l, {
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$k,
emit: ["confirm", ...emit],
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
}) {
......
......@@ -485,7 +485,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var out = safeAreaInsets;
var D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
......@@ -497,10 +497,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
top: top ? top + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top : 0,
bottom: bottom ? bottom + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom : 0,
left: left ? left + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left : 0,
right: right ? right + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right : 0
};
}
function updateCssVar(cssVars) {
......@@ -1194,7 +1194,7 @@ function normalizePageMeta(pageMeta) {
let offset = rpx2px(refreshOptions.offset);
const {type} = navigationBar;
if (type !== "transparent" && type !== "none") {
offset += NAVBAR_HEIGHT + out.top;
offset += NAVBAR_HEIGHT + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
}
refreshOptions.offset = offset;
refreshOptions.height = rpx2px(refreshOptions.height);
......@@ -4621,6 +4621,7 @@ const emit = [
"blur",
"update:value",
"update:modelValue",
"update:focus",
...emit$1
];
function useBase(props2, rootRef, emit2) {
......@@ -4719,7 +4720,7 @@ function useAutoFocus(props2, fieldRef) {
});
onMounted(() => {
if (needFocus.value) {
focus();
nextTick(focus);
}
});
}
......@@ -4818,7 +4819,7 @@ const props$r = /* @__PURE__ */ Object.assign({}, props$s, {
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$r,
emit: ["confirm", ...emit],
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
}) {
......@@ -15021,7 +15022,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight = out.top;
const statusBarHeight = D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
let osname;
let osversion;
let model;
......@@ -15134,12 +15135,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth - out.left - out.right,
height: windowHeight - out.top - out.bottom
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left,
right: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
bottom: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
width: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
height: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom
};
const {top: windowTop, bottom: windowBottom} = getWindowOffset();
windowHeight -= windowTop;
......@@ -15159,10 +15160,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
right: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
bottom: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left
}
};
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册