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

网页设计做音乐网站关键词排名优化网站

网页设计做音乐网站,关键词排名优化网站,创一个app需要多少钱,哈尔滨php网站开发公司需求&#xff1a;封装一个输入框组件 1.只能输入英文。 2.输入的小写英文自动转大写。 3.输入的全角特殊符号自动转半角特殊字符 效果图 代码 <script setup> import { defineEmits, defineModel, defineProps } from "vue"; import { debounce } from "…

需求:封装一个输入框组件
1.只能输入英文。
2.输入的小写英文自动转大写。
3.输入的全角特殊符号自动转半角特殊字符

效果图在这里插入图片描述

代码

<script setup>
import { defineEmits, defineModel, defineProps } from "vue";
import { debounce } from "lodash";/*** 1.只能输入英文* 2.输入的小写英文自动转大写:使用 JavaScript 的 toUpperCase() 方法来转换。* 3.输入的全角特殊符号自动转半角特殊字符:这个也可以通过正则和替换的方式来处理* @type {EmitFn<(string)[]>}*/
const emits = defineEmits(["input", "blur"]);
const inputStyle = defineModel("inputStyle"); // 输入框自定义样式
const inputValue = defineModel();const props = defineProps({// 输入最大长度maxLength: {type: Number,default: 10000},// 是否禁用isDisabled: {type: Boolean,default: false},// 是否显示后缀isShowAppend: {type: Boolean,default: false}
});
// 提示语
const placeholderInput = defineModel("placeholderInput", {default: "请输入"
});// 处理输入的逻辑
const handleInput = debounce(val => {let newValue = val.trim();// 1. 允许中文符号和英文符号的输入// 这里我们允许常见的符号,如:·¥……()【】、;‘,。!@#$%^&*()_+{}|:"<>?~`.,;'\-=\[\]\\\/newValue = newValue.replace(/[^a-zA-Z·¥……()【】、;‘,。!@#$%^&*()_+{}|:"<>?~`.,;'\-=\[\]\\/!]/g,"");// 2. 小写字母自动转为大写newValue = newValue.toUpperCase();// 3. 全角字符转为半角字符newValue = newValue.replace(/[\uFF01-\uFF5E]/g, match =>String.fromCharCode(match.charCodeAt(0) - 0xfee0));// 4. 手动转换全角的【】为半角的[]newValue = newValue.replace(//g, "[").replace(//g, "]");inputValue.value = newValue; // 更新输入框的值emits("input", inputValue.value); // 发出 input 事件
}, 300);// 失去焦点事件
const onBlur = () => {emits("blur", inputValue.value);
};
</script><template><div class="custom_common_input"><el-inputv-model="inputValue"clearable:disabled="isDisabled":maxlength="maxLength":input-style="inputStyle":placeholder="placeholderInput"style="width: 100%"@input="handleInput"@blur="onBlur"><template v-if="isShowAppend" #append><slot name="append" /></template></el-input></div>
</template><style scoped lang="scss">
.custom_common_input {width: 100%;
}
</style>

使用方法

const value = ref("");<BasicInputEn v-model="value" />

最终效果

在这里插入图片描述

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

相关文章:

  • 深圳做网站外包公司有哪些新闻联播直播 今天
  • 护栏板销售网站怎么做长沙在线网站的目标客户
  • 泰州专一做淘宝网站如何用手机免费创建网站
  • 网站开发 怎样做费用结算自动收录
  • 做网站搜索排名的公司工作怎么样百度站长平台电脑版
  • 蜜桃传媒网站优化工具
  • 邢台路桥建设总公司网站西安百度关键词包年
  • 郑州seo网站有优化搜索引擎优化工作
  • 如何构建电子商务网站东莞互联网推广
  • 梧州论坛看点正规seo一般多少钱
  • 传奇网站怎么做什么是网络营销的核心
  • 滁州市城市建设投资有限公司网站优化步骤
  • 自建电商平台方案宁波seo优化公司排名
  • 国外对网站开发的研究搜索排名广告营销
  • 济南做企业网站公司关键词搜索量怎么查
  • 静态门户网站源码廊坊快速优化排名
  • 网站商务通弹出窗口图片更换设置推广方案怎么写模板
  • java 网站开发实例佛山网站建设公司
  • 做网站前端和平面配合高质量软文
  • 网站建设公司浩森宇特简单网页设计模板html
  • 世安建设有限网站在线外链发布工具
  • 什么平台可以做网站seo职位具体做什么
  • 承德专业做网站网站优化seo是什么意思
  • 网站上做网上支付功能营销策划36计
  • 懂的建设网站百度云搜索引擎
  • 如何撤销网站上信息郑州网络推广排名
  • 和狗狗做电影网站营销软件代理推广
  • 店面设计效果图大全seo优化工作
  • 企业网站建设作品分析2023年的新闻十条
  • jtbc网站内容管理系统搜索引擎成功案例分析