这里会提示
Vue: Property tagName does not exist on type EventTarget
chatgpt解释如下:
The error "Vue: Property 'tagName' does not exist on type 'EventTarget'" is occurring because TypeScript does not know that the EventTarget can be an Element, which has the tagName property. To fix this, you can use type assertion to tell TypeScript that the EventTarget is actually an Element. Here's how you can do it:
function handleKeydown(event: KeyboardEvent) {
// 排除元素
const eles = ['INPUT', 'TEXTAREA']
if (eles.includes((event.target as Element).tagName))
return
if (event.code === 'KeyC')
closeModal()
}
n this code, (event.target as Element).tagName tells TypeScript to treat event.target as an Element, which has the tagName property.
这里会提示
Vue: Property tagName does not exist on type EventTarget
chatgpt解释如下:
The error "Vue: Property 'tagName' does not exist on type 'EventTarget'" is occurring because TypeScript does not know that the EventTarget can be an Element, which has the tagName property. To fix this, you can use type assertion to tell TypeScript that the EventTarget is actually an Element. Here's how you can do it:
function handleKeydown(event: KeyboardEvent) {
// 排除元素
const eles = ['INPUT', 'TEXTAREA']
if (eles.includes((event.target as Element).tagName))
return
if (event.code === 'KeyC')
closeModal()
}
n this code, (event.target as Element).tagName tells TypeScript to treat event.target as an Element, which has the tagName property.
function onEsc(event) {
const eles = ['INPUT', 'TEXTAREA']
const keys = ['KeyC', 'KeyP', 'KeyX']
console.log(event.code)
去一下log
const passDialog = ref(false)
// 审核不通过弹窗状态 只做记录,不影响业务
const rejectDialog = ref(false)
const rejectDialogCom = ref < (null)
这个代码正常用嘛?
const rejectDialog = ref(false)
const rejectDialogCom = ref < (null)
// 关闭所有页面弹窗
const modal = useModal()
这个声明没有看到哪里有使用,
如果没有 去一下
有的话 列举出来
const containerWidth = container.offsetWidth
const containerHeight = container.offsetHeight
const containerWidth = container?.offsetWidth
const containerHeight = container?.offsetHeight
这两个声明有什么作用吗? 都没有被使用过
这是之前的代码,看逻辑是没用。
searchFixVal.value = ''
}
else {
emit('showDialog', val)
看了一下代码,这个 emit 没有被声明
function handleKeydown(event: KeyboardEvent) {
// 排除元素
const eles = ['INPUT', 'TEXTAREA']
if (eles.includes(event?.target?.tagName))
这里会提示
Vue: Property tagName does not exist on type EventTarget
chatgpt解释如下:
The error "Vue: Property 'tagName' does not exist on type 'EventTarget'" is occurring because TypeScript does not know that the EventTarget can be an Element, which has the tagName property. To fix this, you can use type assertion to tell TypeScript that the EventTarget is actually an Element. Here's how you can do it:
function handleKeydown(event: KeyboardEvent) {
// 排除元素
const eles = ['INPUT', 'TEXTAREA']
if (eles.includes((event.target as Element).tagName))
return
if (event.code === 'KeyC')
closeModal()
}
n this code, (event.target as Element).tagName tells TypeScript to treat event.target as an Element, which has the tagName property.
848ecd9838
into test 1 year ago848ecd9838
.