当前位置:网站首页>Some problems encountered in recent programming 2021 / 9 / 8
Some problems encountered in recent programming 2021 / 9 / 8
2022-04-23 17:03:00 【Eli-sun】
1
First of all el-autocomplete When this component makes a fuzzy query , To limit input to numbers , And limit the length of the input
<el-autocomplete
v-model="phoneNumber"
:fetch-suggestions="querySearch"
:maxlength="length"
placeholder=" Please enter the contact number "
oninput="value=value.replace(/[^\d]/g,'')"
@select="handleSelect"
/>
Give her one maxlength attribute , But this must be a number , It doesn't work if it's not a number , So you can dynamically bind a number .
It can be used oninput Limit what is entered .
2
Intercepts a portion of a string
let str1=str.substring(0,ipos); // Take the front part ( Specify the beginning of the string before )
// For example, I need to intercept the first three characters of the string
let str = 'abcdefg'
str.substring(0,3)
// Back to you abc
3
element-UI Verification rules for license plate numbers (vue)
// Written in data Inside
var carPhoneValid = (rule, value, callback) => {
const plateNumber = /^([ Beijing, Tianjin, Shanghai, Chongqing, Hebei, Henan, Yunnan, Liaoning, Heilongjiang, Hunan, Anhui, Shandong, new Jiangsu, Zhejiang, Jiangxi, Hubei, Guangxi, Gansu, Shanxi, Inner Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai Tibet, Sichuan, Ningxia and Hainan A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([ Beijing, Tianjin, Shanghai, Chongqing, Hebei, Henan, Yunnan, Liaoning, Heilongjiang, Hunan, Anhui, Shandong, new Jiangsu, Zhejiang, Jiangxi, Hubei, Guangxi, Gansu, Shanxi, Inner Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai Tibet, Sichuan, Ningxia and Hainan A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 Hang the school police in Hong Kong and Macao ]{1})$/
if (!value) {
callback(new Error(' Please enter the license plate number '))
} else if (plateNumber.test(value)) {
callback()
} else {
callback(new Error(' Wrong license plate number format '))
}
}
// rules
carNum: [
{ required: true, validator: carPhoneValid, trigger: 'blur' }
],
4
stay el-dialog Clear after closing el-form Validation rules for
to el-dialog Bind one @close="closeadd2Dialog" Method
closeadd2Dialog() {
this.$refs.addNewForm.resetFields()
},
5
You can write the tips you want
this.$message({
message: ' Reason cannot be empty ',
type: 'error'
})
6
When /deep/ When it doesn't work , It can be used ::v-deep
::v-deep .el-textarea{
width: 100%;
}
7
Use replace Function substitution
str = '2021-09-08T15:05:34.20'
// Remove a string contained in a string :str = str.replace('T', ' ');
// Here is the handle. T Replace with space
// Get rid of T And milliseconds can be written as
str.replace('T', ' ').substring(0, 19)
// Be careful : You cannot write here :str.replace(‘give’, ‘’); Writing :str = str.replace(‘give’, ‘’);
版权声明
本文为[Eli-sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554290223.html
边栏推荐
- How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
- Use case execution of robot framework
- Milvus 2.0 质量保障系统详解
- Redis docker installation
- Error in v-on handler: "typeerror: cannot read property 'resetfields' of undefined"
- Go language RPC communication
- Website_ Collection
- Copy constructor shallow copy and deep copy
- Wiper component encapsulation
- 批量制造测试数据的思路,附源码
猜你喜欢
Idea of batch manufacturing test data, with source code
True math problems in 1959 college entrance examination
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
Milvus 2.0 détails du système d'assurance de la qualité
Shell script -- shell programming specification and variables
STM32__ 03 - beginner timer
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘
Zhongang Mining: Fluorite Flotation Process
Loggie source code analysis source file module backbone analysis
随机推荐
Installing labellmg tutorial in Windows
Linux MySQL data timing dump
Nifi fast installation and file synchronization
1-2 characteristics of nodejs
文件操作《二》(5000字总结篇)
Shell脚本——Shell编程规范及变量
◰GL-阴影贴图核心步骤
Mock test
ByteVCharts可视化图表库,你想要的我都有
TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘
ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation
∑GL-透视投影矩阵的推导
freeCodeCamp----shape_ Calculator exercise
Regular filtering of Intranet addresses and segments
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
Go language RPC communication
Shortcut keys (multiline)
Use case execution of robot framework
Error in v-on handler: "typeerror: cannot read property 'resetfields' of undefined"