-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uni-app的内置组件,没有相关的typescript类型定义,怎么引入 #4750
Comments
试试原生事件? <template>
<input type="text" @input="_input">
</template>
<script setup lang="ts">
const _input = (e: Event) => {
// 这行日志?
console.log((e.target as HTMLInputElement).value)
}
</script> |
<template>
<input @input="onInput"></input>
</template>
<script lang="ts" setup>
import type { InputOnInputEvent } from "@uni-helper/uni-app-types";
function onInput(event: InputOnInputEvent) {
console.log(event.detail.value);
}
</script> |
完美解决,十分感谢 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
如下代码:
现在onInput函数的类型输入是any,我想让
v.detail.value
与具有类型提示,怎么才能让他具有实际的类型。我在HBuilderX中尝试了InputEvent
,但是这个类型好像和组件中使用的不太一样,这是我通过alt + 点击
进入看到的类型定义:系统信息:
补充信息
其中
v.detail.value
是input组件官方文档中描述的属性:The text was updated successfully, but these errors were encountered: