当前位置:网站首页>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
边栏推荐
- Installing labellmg tutorial in Windows
- Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
- [pimf] openharmony paper Club - what is the experience of wandering in ACM survey
- Kingdee Cloud Star API calling practice
- How to implement distributed locks with redis?
- MySQL master-slave replication
- Read a blog, re understand closures and tidy up
- 1-1 NodeJS
- 深入了解3D模型相关知识(建模、材质贴图、UV、法线),置换贴图、凹凸贴图与法线贴图的区别
- Website_ Collection
猜你喜欢
Rtklib 2.4.3 source code Notes
Scope and scope chain in JS
Nifi fast installation and file synchronization
[registration] tf54: engineer growth map and excellent R & D organization building
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
STM32__ 03 - beginner timer
Get the column name list of the table quickly in Oracle
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
Smart doc + Torna generate interface document
随机推荐
Encapsulating the logging module
Path environment variable
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
How to implement distributed locks with redis?
[PROJECT] small hat takeout (8)
MySQL master-slave configuration under CentOS
Grpc gateway based on Ocelot
Installing labellmg tutorial in Windows
MySQL modify master database
Knowledge points and examples of [seven input / output systems]
About stream flow, write it down briefly------
Detailed explanation of Milvus 2.0 quality assurance system
1-3 nodejs installation list configuration and project environment
Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
1-2 JSX syntax rules
Tencent resolves the address according to the IP address
websocket
如何用Redis实现分布式锁?
PHP efficiently reads large files and processes data
Getting started with JDBC