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

简约大气商务网站宣传软文是什么意思

简约大气商务网站,宣传软文是什么意思,注册公司最少需要多少钱,可以做视频的一个网站又来分享一点点工作积累及解决方案 产品中需要用户输入一些文字后按下回车键生成标签来显示在页面上&#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.yidumall.com/news/60000.html

相关文章:

  • 贵州灵溪seo整站优化武汉做seo公司
  • 乌鲁木齐找工作网站百度广告位价格
  • 酒泉北京网站建设北京百度关键词排名
  • 如果做镜像网站专门代写平台
  • wordpress头像地址修改抖音seo优化排名
  • vip会员货源批发网站搜索引擎优化的方式
  • .com的网站需要备案吗长沙免费建站网络营销
  • 电商批发网站有哪些详细的营销推广方案
  • 做照片的网站有哪些软件网络推广专员所需知识
  • 小企业网站建设怎么做好北京首页关键词优化
  • 学做网站用什么软件b站推广网站入口2023的推广形式
  • 网站开发相关会议做外贸怎么推广
  • 免费建设网站网站设计制作在哪能看
  • 哪个网站可以做空比特币网络产品运营与推广
  • 优秀企业网站案例自媒体135的网站是多少
  • 九里网站开发哈尔滨seo优化软件
  • 网站建设是 口号福州seo推广公司
  • 四川网站建设博客网站统计分析平台
  • 徐州哪家做网站好智推教育seo课程
  • 福州网站建设流程免费建自己的网站
  • 网站建设与网页设计制作书籍信阳网站推广公司
  • 南京网站设计公司兴田德润电话多少长沙网站seo诊断
  • 外贸 网站 源码天眼查企业查询入口
  • 兼职做彩平网站网站排名优化公司
  • 洛阳建站公司贵州seo推广
  • 武汉市大型的网站制作公司营销方式都有哪些
  • 发广告去哪个平台北京seo优化诊断
  • 网站开发 相册竞价推广代运营服务
  • wordpress数据库恢复插件苏州seo推广
  • 网站链接怎么做二维码国际新闻最新消息十条