当前位置: 首页 > wzjs >正文

虚拟主机怎么建网站做一个网站需要多少钱大概

虚拟主机怎么建网站,做一个网站需要多少钱大概,做阿里国际网站多少钱,wordpress翻页代码应用效果:从第一行输入1,按回车,聚焦到第二行输入2,按回车,聚焦到第三行…… 一、通过元素 id,聚焦到下一行的输入框 关键技术点: 1、动态设置元素 id 属性为::id"input-appl…

应用效果:从第一行输入1,按回车,聚焦到第二行输入2,按回车,聚焦到第三行……

一、通过元素 id,聚焦到下一行的输入框

关键技术点:

1、动态设置元素 id 属性为::id="`input-apply-amount-${(option as IReagentOption).id}`"

2、设置回车监听:@keyup.enter.native="onEnterPressDown((option as IReagentOption).id)"

                <el-input......:id="`input-apply-amount-${(option as IReagentOption).id}`"@keyup.enter.native="onEnterPressDown((option as IReagentOption).id)" />

3、通过 document.getElementById 获取到指定元素

4、focus 和 select,聚焦、全选

// 通过元素 id,聚焦到下一行的输入框
const focusNextRowByElementId = (objId: number) => {// 通过 objId 获取当前行索引let currentRowIndex = selectedOptionIds.value.indexOf(objId);// 下一行的输入框let nextInput: HTMLInputElement;if (currentRowIndex + 1 < selectedOptionIds.value.length) {// 下一行索引的 objIdlet nextRowObjId = selectedOptionIds.value[currentRowIndex + 1];nextInput = document.getElementById(`input-apply-amount-${nextRowObjId}`) as HTMLInputElement;} else {// 最后一行聚焦到申领用途输入框nextInput = document.getElementById("transfer-right-footer-purpose-input") as HTMLInputElement;}nextInput?.focus();nextInput?.select();
};

二、通过元素 ref,聚焦到下一行的输入框

关键技术点:

1、动态设置元素 ref 属性为::ref="`input-apply-amount-${(option as IReagentOption).id}`"

2、设置回车监听:@keyup.enter.native="onEnterPressDown((option as IReagentOption).id)"

                <el-input......:ref="`input-apply-amount-${(option as IReagentOption).id}`"@keyup.enter.native="onEnterPressDown((option as IReagentOption).id)" />

3、通过 getCurrentInstance() 获取当前组件实例,再通过 refs 获取到元素列表

4、focus 和 select,聚焦、全选

<script setup lang="ts" name="ReagentApplyDialog">
......
import { getCurrentInstance } from "vue";// 当前组件实例,相当 vue2 的this
const thisInstance = getCurrentInstance();// 通过元素 ref,聚焦到下一行的输入框
const focusNextRowByElementRef = (objId: number) => {if (!thisInstance) return;// 获取输入框实例 Recordlet refs = thisInstance.refs as Record<string, HTMLInputElement>;// 通过 objId 获取当前行索引let currentRowIndex = selectedOptionIds.value.indexOf(objId);if (currentRowIndex + 1 < selectedOptionIds.value.length) {// 下一行索引的 objIdlet nextRowObjId = selectedOptionIds.value[currentRowIndex + 1];// 聚焦到下一行的输入框refs[`input-apply-amount-${nextRowObjId}`].focus();refs[`input-apply-amount-${nextRowObjId}`].select();} else {// 最后一行聚焦到申领用途输入框refs["transfer-right-footer-purpose-input"].focus();refs["transfer-right-footer-purpose-input"].select();}
};
......
</script>

实例完整代码:

<script setup lang="ts" name="ReagentApplyDialog">
......
import { getCurrentInstance, nextTick, onMounted, ref, watch } from "vue";// 当前组件实例,相当 vue2 的this
const thisInstance = getCurrentInstance();// 按回车,申领数量输入框按回车
const onEnterPressDown = (objId: number) => {// 奇数if (objId % 2 === 1) {// 通过元素 id,聚焦到下一行的输入框focusNextRowByElementId(objId);}// 偶数else {// 通过元素 ref,聚焦到下一行的输入框focusNextRowByElementRef(objId);}
};// 通过元素 id,聚焦到下一行的输入框
const focusNextRowByElementId = (objId: number) => {// 通过 objId 获取当前行索引let currentRowIndex = selectedOptionIds.value.indexOf(objId);// 下一行的输入框let nextInput: HTMLInputElement;if (currentRowIndex + 1 < selectedOptionIds.value.length) {// 下一行索引的 objIdlet nextRowObjId = selectedOptionIds.value[currentRowIndex + 1];nextInput = document.getElementById(`input-apply-amount-${nextRowObjId}`) as HTMLInputElement;} else {// 最后一行聚焦到申领用途输入框nextInput = document.getElementById("transfer-right-footer-purpose-input") as HTMLInputElement;}nextInput?.focus();nextInput?.select();
};// 通过元素 ref,聚焦到下一行的输入框
const focusNextRowByElementRef = (objId: number) => {if (!thisInstance) return;// 获取输入框实例 Recordlet refs = thisInstance.refs as Record<string, HTMLInputElement>;// 通过 objId 获取当前行索引let currentRowIndex = selectedOptionIds.value.indexOf(objId);if (currentRowIndex + 1 < selectedOptionIds.value.length) {// 下一行索引的 objIdlet nextRowObjId = selectedOptionIds.value[currentRowIndex + 1];// 聚焦到下一行的输入框refs[`input-apply-amount-${nextRowObjId}`].focus();refs[`input-apply-amount-${nextRowObjId}`].select();} else {// 最后一行聚焦到申领用途输入框refs["transfer-right-footer-purpose-input"].focus();refs["transfer-right-footer-purpose-input"].select();}
};
......
</script><template>
......<el-transfer......><!-- 自定义列表数据项的内容 --><template #default="{ option }">......<el-inputv-if="selectedOptionIds.includes((option as IReagentOption).id)":ref="`input-apply-amount-${(option as IReagentOption).id}`":id="`input-apply-amount-${(option as IReagentOption).id}`"class="input-apply-amount"style="width: 85px; text-align: center"v-model="(option as IReagentOption).applyAmount"placeholder="输入申领数量"size="small"clearable@input="(option as IReagentOption).applyAmount = Number(formatToNumber($event, 0))"@keyup.enter.native="onEnterPressDown((option as IReagentOption).id)" />......</template></el-transfer>
......
</template>

http://www.dtcms.com/wzjs/99107.html

相关文章:

  • 做网站怎么加背景图片线下营销方式主要有哪些
  • 柯桥区网站建设网站加速器
  • 武汉网站建设不推广浏览器里面信息是真是假
  • 哈尔滨网站建设索q.479185700快推广app下载
  • 网站建设 重庆交换友情链接前后必须要注意的几点
  • 服装网站建设费用百度收录提交网站后多久收录
  • 网站维护中一般要多长时间网站描述和关键词怎么写
  • 如何加强旅游电子商务网站的建设网上推广产品怎么做
  • 手机上做整蛊网站百度搜索收录入口
  • 恩施网站开发旅行网站排名
  • 站长工具端口检测seo平台是什么意思
  • 重庆公积金门户网站广州seo顾问seocnm
  • 建设网站简单的需要多少天嘉兴优化公司
  • 建设网站安全措施企业网站优化工具
  • 大良营销网站建设服务网络营销策划活动方案
  • 做网站需不需要购买服务器怎样淘宝seo排名优化
  • 通过网站做跳板网站制作基本流程
  • 如何做自己的加盟网站少女长尾关键词挖掘
  • 网站做英文版有用吗品牌策划方案范文
  • 怎样拉注册公司客户搜索引擎网站推广如何优化
  • 龙港哪里有做百度网站的互联网公司排名
  • 新网站建设平台优化电池充电什么意思
  • html怎么做商品页面汕头seo推广优化
  • 记事本做的网站链接怎么装饰太原搜索引擎优化
  • 住房和城乡建设部网站 绿地列举常见的网络营销工具
  • 一般网站建设企业上海seo服务外包公司
  • 郑州网站建设熊掌号谷歌官方app下载
  • 重庆大渡口营销型网站建设公司推荐苏州关键词搜索排名
  • 网页游戏网站斗地主seo软件工具
  • 珠海网站建设的公司排名福州网站seo公司