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

网站建设冒用身份信息定西企业网站制作

网站建设冒用身份信息,定西企业网站制作,上海网站建设服务站霸网络,中国菲律宾南海仁爱礁最新新闻需求&#xff1a;根据数据中的html&#xff0c;因为我是在做填空&#xff0c;所以是需要将html中的_____替换成input&#xff0c;由于具体需求我使用的是元素contenteditable代替的可编辑的input html部分 <div class"wrap"><component :is"rendered…

需求:根据数据中的html,因为我是在做填空,所以是需要将html中的_____替换成input,由于具体需求我使用的是元素contenteditable代替的可编辑的input

html部分

<div class="wrap"><component :is="renderedContent" ref="wrap_component" /></div>

js部分

// 这个是为了保证输入的时候光标保持在最后
const moveCursorToEnd = (element: HTMLElement) => {const range = document.createRange();const selection = window.getSelection();// 找到最后一个文本节点let lastTextNode: Text | any = null;const traverseNodes = (node: Node) => {if (node.nodeType === Node.TEXT_NODE) {lastTextNode = node as Text;}for (let i = 0; i < node.childNodes.length; i++) {traverseNodes(node.childNodes[i]);}};traverseNodes(element);if (lastTextNode) {range.setStart(lastTextNode, lastTextNode.textContent?.length || 0);range.collapse(true);if (selection) {selection.removeAllRanges();selection.addRange(range);}} else {range.setStart(element, 0);range.collapse(true);if (selection) {selection.removeAllRanges();selection.addRange(range);}}// 兼容性处理:确保元素获取焦点element.focus();if (document.activeElement !== element) {element.focus();}
};// 计算属性,用于生成渲染内容
const renderedContent = computed(() => {if (!itemConf.value.customConf?.inputHtml) return null;const parts = itemConf.value.customConf.inputHtml.split(/_{1,}/);let nodes: any = [];parts.forEach((part, index) => {if (part) {const replacedSpaces = part.replace(/ /g, '&nbsp;');const replacedPart = replacedSpaces.replace(/<div>/g, '<br>').replace(/<\/div>/g, '');nodes.push(h('span', { class: 'custom-span', innerHTML: replacedPart }));}if (index < parts.length - 1) {if (!inputValues.value[index]) {inputValues.value[index] = '';}if (!isInputFocused.value[index]) {isInputFocused.value[index] = false;}if (!isClearIconClicked.value[index]) {isClearIconClicked.value[index] = false;}if (!clearIconHideTimer.value[index]) {clearIconHideTimer.value[index] = 0;}const clearIcon = h(ElIcon,{class: ['clear_icon',{'is-hidden':inputValues.value[index].length === 0 ||itemConf.value.baseConf.isReadOnly ||!isInputFocused.value[index],},],onClick: () => {if (!itemConf.value.baseConf.isReadOnly) {isClearIconClicked.value[index] = true;inputValues.value[index] = '';if (inputRefs.value[index]) {inputRefs.value[index].innerText = '';}adjustInputWidth(index);handleChange(itemConf.value.customConf.inputGroup[index], '');// 点击后清除隐藏定时器clearTimeout(clearIconHideTimer.value[index]);}},},{ default: () => h(CircleClose) },);const inputNode = h('p',{contenteditable: !itemConf.value.baseConf.isReadOnly,class: ['underline_input',{'is-disabled': itemConf.value.baseConf.isReadOnly,},],disabled: itemConf.value.baseConf.isReadOnly,innerHTML: inputValues.value[index],placeholder: unref(itemConf).customConf?.inputGroup[index]?.placeholder || '请输入',onInput: async (event: InputEvent) => {const target = event.target as HTMLParagraphElement;adjustInputWidth(index);inputValues.value[index] = target.innerHTML;await nextTick(() => {moveCursorToEnd(target);});},onFocus: () => {if (!itemConf.value.baseConf.isReadOnly) {isInputFocused.value[index] = true;clearTimeout(clearIconHideTimer.value[index]);}},onBlur: () => {if (!itemConf.value.baseConf.isReadOnly) {handleChange(itemConf.value.customConf.inputGroup[index], inputValues.value[index]);clearIconHideTimer.value[index] = setTimeout(() => {if (!isClearIconClicked.value[index]) {isInputFocused.value[index] = false;}isClearIconClicked.value[index] = false;}, 200);}},onMousedown: (event: MouseEvent) => {if (itemConf.value.baseConf.isReadOnly) {event.preventDefault();event.stopPropagation();}},onKeydown: (event: KeyboardEvent) => {if (itemConf.value.baseConf.isReadOnly) {event.preventDefault();event.stopPropagation();}},ref: (el) => (inputRefs.value[index] = el),},// [clearIcon],);nodes.push(h('p', { class: 'underline_input_wrap' }, [inputNode, clearIcon]));}});return h('div', nodes);
});

css部分


.underline_input_wrap {display: inline-block;// max-width: calc(100% - 70px);position: relative;margin-top: 20px;margin-bottom: 0;max-width: calc(100% - 50px);
}
.underline_input {position: relative;height: 40px;min-width: 101px;// max-width: calc(100% - 70px);max-width: 100%;background: #f5f7fb;border-radius: 6px 6px 6px 6px;border: none;margin-left: 10px;margin-top: 0;margin-bottom: 0;display: inline-block;box-sizing: border-box;padding: 0 26px 0 12px;background: #f5f7fb;vertical-align: middle;color: #606266;background: #f5f7fb;vertical-align: middle;&:focus {outline: none;border: 1px solid #1a77ff;color: #606266;}&:disabled {color: #bbbfc4;cursor: not-allowed;}&::placeholder {color: #a8abb2;font-size: 14px;}
}.underline_input.is-disabled {color: #bbbfc4;cursor: not-allowed;
}.underline_input[contenteditable='true']:empty::before,
.underline_input.is-disabled:empty::before {content: attr(placeholder);color: #bbbfc4;
}
:deep(.clear_icon) {position: absolute;width: 14px;height: 14px;right: 5px;top: 50%;transform: translateY(-50%);cursor: pointer;color: #999;z-index: 10; /* 增加 z-index 确保在最上层 */&:hover {color: #666;}&.is-hidden {display: none;}
}

我们要模拟input可清除,所以需要我们去调整样式,以及placeholder样式问题


文章转载自:

http://cgUoRrMb.mwbqk.cn
http://D7P5IKap.mwbqk.cn
http://cVZtIsy8.mwbqk.cn
http://ChtDucGR.mwbqk.cn
http://URaGWlBU.mwbqk.cn
http://l0ORiSH9.mwbqk.cn
http://4TwjAsXa.mwbqk.cn
http://0hPQqVgC.mwbqk.cn
http://ZLscfPU3.mwbqk.cn
http://mznTrkOi.mwbqk.cn
http://4tDLvCRk.mwbqk.cn
http://xGmI4Ldz.mwbqk.cn
http://VwOnlb8k.mwbqk.cn
http://E4xugTDt.mwbqk.cn
http://UdhxIC3V.mwbqk.cn
http://LOr56RxB.mwbqk.cn
http://RnASxKSC.mwbqk.cn
http://LmbHzzgD.mwbqk.cn
http://yjlbItyA.mwbqk.cn
http://0QLj5FMb.mwbqk.cn
http://S0pJjN8b.mwbqk.cn
http://NgxXUj0s.mwbqk.cn
http://RZMynJ8m.mwbqk.cn
http://iODk19Ks.mwbqk.cn
http://h33gykuE.mwbqk.cn
http://nNn2dTaR.mwbqk.cn
http://Zd6BI9S8.mwbqk.cn
http://IZwqIbxN.mwbqk.cn
http://biKWZwNn.mwbqk.cn
http://lKh7vCY7.mwbqk.cn
http://www.dtcms.com/wzjs/631578.html

相关文章:

  • 2018做网站用什么开发赛事网站开发
  • pr值高的网站网站开发模块的需求
  • 中国空间站扩建做设计及免费素材网站有哪些
  • 汽车用品网站源码wordpress手机端网站模板
  • 高端手表资质类网站如何做优化
  • 个人网站建设方案书实例手机网址大全哪个好
  • 我想注册网站我怎么做从零开始建网站
  • 网站开发团队 分工网站备案换公司吗
  • 金山专业网站建设钓鱼网站建设
  • 网站开发 书用户体验设计流程
  • 用网站ip做代理可信网站图标 费流量
  • 企业网站策划案怎么写新品怎么刷关键词
  • 花木网站模版营销管理咨询
  • 国外大型购物网站动漫与游戏制作专业有前途吗
  • 两学一做网站视频北京漫步云端网站建设
  • 做宾馆网站网站目录优化
  • 网站开发与制作网上接工程活做的网站
  • 织梦 调用网站地址网站内容和备案不一
  • 有关大数据的网站及网址谷歌优化师是做什么的
  • 长沙企业建站系统网络运维服务平台
  • 网站定制开发费用多少php网站开发手机绑定
  • 网站开发了解客户需求希尔顿酒店网站建设的优点
  • 网站建设中合作加盟的作用如何充实网站内容
  • 大连 网站建设全国被执行人名单查询
  • 成都装修公司一览表河北百度seo关键词排名
  • 做网站电子版报价模板精简wordpress头部信息
  • 做网站怎么样引流网站建设 昆明邦凯网络
  • 广州中新知识城开发建设网站第八章 电子商务网站建设课件
  • 公司网站怎么做推广网站备案收录下降
  • 电子商务网站建设与管理的理解摄影设计说明200字