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

asp.net 网站截图广东省建设厅官网查询

asp.net 网站截图,广东省建设厅官网查询,购物网站建设流程,毕业室内设计代做网站又来分享一点点工作积累及解决方案 产品中需要用户输入一些文字后按下回车键生成标签来显示在页面上&#xff0c;经过尝试与改造完成如下&#xff1a; <template><div class"tags-view" click"beginInput"><el-tag :key"index" …

又来分享一点点工作积累及解决方案

产品中需要用户输入一些文字后按下回车键生成标签来显示在页面上,经过尝试与改造完成如下:

<template><div class="tags-view" @click="beginInput"><el-tag :key="index" v-for="(tag, index) in dynamicTags" closable :disable-transitions="false"@close="handleClose(index)">{{ tag }}</el-tag><el-input v-if="inputVisible" class="input-new-tag" style="width: 100%;" v-model="inputValue" ref="saveTagInput"size="small" @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm"></el-input><!-- <el-button v-else class="button-new-tag" size="small" @click="showInput">+</el-button> --></div>
</template><script>
export default {name: 'inputTag',props: {tags: {type: Array,default: []},},watch: {tags: {deep: true,immediate: true,handler(val) {this.dynamicTags = val || []}}},data() {return {dynamicTags: [],inputVisible: false,inputValue: ''};},methods: {handleClose(index) {this.dynamicTags.splice(index, 1);},showInput() {this.inputVisible = true;this.$nextTick(_ => {this.$refs.saveTagInput.$refs.input.focus();});},beginInput() {this.showInput();},handleInputConfirm() {let inputValue = this.inputValue;if (inputValue) {this.dynamicTags.push(inputValue);}const inputElement = this.$refs.saveTagInput.$refs.input; // 获取input DOM元素const isFocused = document.activeElement === inputElement; // 判断是否为当前焦点this.inputVisible = isFocused;this.inputValue = '';this.$emit('changed', this.dynamicTags)}}
}
</script><style lang="scss" scoped>
.tags-view {display: flex;flex-direction: row;justify-content: flex-start;align-items: center;flex-wrap: wrap;min-height: 32px;padding: 4px 5px;border: 1px solid #DCDFE6;border-radius: 4px;
}.button-new-tag {margin-left: 10px;height: 24px;line-height: 24px;padding-top: 0;padding-bottom: 0;
}.input-new-tag {height: 24px;line-height: 24px;width: 90px;//margin-left: 10px;vertical-align: bottom;
}::v-deep {.el-tag {margin-left: 5px;margin-top: 2px;margin-bottom: 2px;}.el-input__inner {height: 24px;line-height: 24px;border: none;padding: 0px 5px;}
}
</style>

组件的使用:

import InputTag from '../components/inputTag.vue'

tags用于默认值的回调,changed事件用于组件数据发生变化时的回调通知。 

<InputTag class="w-100" :tags="tagsValue" @changed="tagsChanged"></InputTag>

组件本身也比较简单,没有啥值得去细分和品评的技术点

enter事件和blur事件走了同一个事件,会导致输入不连续,为解决这个问题,我们只需要判断当前input是不是焦点,如果是,则不隐藏输入框即可,如下isFoucsed变量的判断即为是否本身自己是当前焦点的input!

handleInputConfirm() {let inputValue = this.inputValue;if (inputValue) {this.dynamicTags.push(inputValue);}const inputElement = this.$refs.saveTagInput.$refs.input; // 获取input DOM元素const isFocused = document.activeElement === inputElement; // 判断是否为当前焦点this.inputVisible = isFocused;this.inputValue = '';this.$emit('changed', this.dynamicTags)
}
http://www.yayakq.cn/news/662561/

相关文章:

  • 宜阳网站建设wordpress导航 t
  • 如何做视频网站不侵权扬州网站建设文章
  • 公司网站开发教程上海做网站技术
  • 公司做网站一般新开传奇手游
  • 营销型网站是什么样的12306网站开发多少钱
  • 网站建设开发ppt模板下载天津建设工程信息网中标
  • 十大网站南阳网站推广费用
  • 深圳龙华住房和建设局网站官网wordpress 开启链接
  • 做一些网站的弹出页面网站建设平台报价
  • 建设旅游网站的目的网站设计可以用性原则
  • 门户网站的功能国家企业信用信息查询平台官网
  • 长春找工作哪个网站好门户网站的意义
  • 室内设计网站大全网站精美化妆品网站模板
  • 网站定位与功能分析wordpress浮动小人插件
  • 简述网站开发具体流程网站设计培训
  • 关于重新建设网站的申请表长治电商平台网站
  • 做网站聚合做权重难吗手机网站图片滑动
  • 玉林网站建设培训北京怎样建设公司网站
  • 天津做网站要多少钱旅游网站设计需求分析
  • 网站建设费的账务处理蚌埠的网站建设
  • 网站开发验收标准wordpress 绿色 炫 模板
  • 如何用cms做网站吉林省建设厅网站首页
  • 买个域名自己做网站wordpress返回顶部插件
  • 做封面下载网站信用网站建设意义
  • 网站建设的搜索语句wordpress get_tags
  • 建设银行网站图片大全购物网站开发的意义
  • 网站建设同行抄袭wordpress 空格 插件
  • 织梦网站地图优化做网站公司费用
  • 买模板做网站建设工程监理 精品课网站
  • 基于站点的推广jsp网站缓存在哪