ant-design-vue 1.X 通过id获取a-input组件失败

1.ant-design-vue 1.X

问题描述

当我在a-form组件中,以v-decorator指令绑定表单组件时,无法根据我设置的verify-code-input获取元素

html 复制代码
<a-input type="text" 
	id="verify-code-input" 
	class="paIpt"
	:placeholder="$t('register.register_verification_code1')"
    v-decorator="['verifyCode', validatorRules.verifyCode]" />
js 复制代码
document.getElementById('verify-code-input'); // null

原因分析

我查看了网页源码,发现input元素已经有了id="verifyCode",因此我们设置的verify-code-input无法生效

html 复制代码
<input data-v-58ee6438="" placeholder="Verification Code" type="text" id="verifyCode" data-__meta="[object Object]" data-__field="[object Object]" class="paIpt ant-input">
相关推荐
nuIl5 分钟前
实现一个 Coding Agent(4):ReAct 循环
前端·agent·cursor
nuIl6 分钟前
实现一个 Coding Agent(1):一次 LLM 调用
前端·agent·cursor
nuIl6 分钟前
实现一个 Coding Agent(2):让 LLM 流式响应
前端·agent·cursor
copyer_xyf8 分钟前
Python 异常处理
前端·后端·python
sugar__salt15 分钟前
从栈队列数据结构到JS原型面向对象全解
前端·javascript·数据结构
MageGojo25 分钟前
随机文案模块怎么做?从接口封装到前端展示的完整实现思路
javascript·前端开发·api接口·后端开发·随机文案
独特的螺狮粉26 分钟前
篮球集训班器具管理系统 - 鸿蒙PC Electron框架完整技术实现指南
前端·javascript·华为·electron·前端框架·开源·鸿蒙
小妖66627 分钟前
js 生成随机数技巧 Math.random().toString(36)
javascript·随机数
pusheng202528 分钟前
IFSJ全英文专访:中国创新力量重塑先进气体感知技术,赋能全球关键基础设施安全
前端·网络·人工智能·物联网·安全
AI_零食1 小时前
番茄钟鸿蒙PC Electron框架完成:状态机、定时器管理与专注力工具设计
前端·javascript·华为·electron·开源·鸿蒙·鸿蒙系统