小程序判断文本中是否有电话号码

news/2024/7/19 12:53:21 标签: 小程序, js

js

    var re = /\d{11}/;
    if (re.test(这里是你要判断的文本----) != true) {
      console.log('没有手机号')

    } else {
      console.log('有手机号');

      wx.showToast({
        title: '评论不能输入手机号请删除',
        icon: 'none',
        duration: 1000
      })

    }

http://www.niftyadmin.cn/n/957968.html

相关文章

在https://codepen.io/hamigua2019/pen/WNoPyzX中运行vue代码出现的两个bug,还是没有解决

代码如下 html <div id"counter">Counter: {{ counter }} </div>js const Counter {data() {return {counter: 0}} }Vue.createApp(Counter).mount(#counter)这样直接运行时&#xff0c;报vue没有定义的错 加了import { createApp } from vue’以后…

小程序中字符串转数组 去重复· 数组转字符串

JS 字符串转数组&#xff1a;var words likely, likely, likely,economic, economic; //字符串中间已特殊符号隔开var words words.split(","); //转成数组类似php的explode函数JS 字符串去重:function unique (array){return array.filter(function(el, in…

使用IDEA GIT CHERRY-PICK, 将一个分支的COMMIT, GIT PUSH到另一个分支, git 摘樱桃

使用IDEA GIT CHERRY-PICK, 将一个分支的COMMIT, GIT PUSH到另一个分支 idea git cherry-pick 什么是git cherry-pick?用idea进行git cherry-pick 1 首先, 切换到想要git push的分支master2 把annotation-processor分支上的一些commit进行git cherry-pick3 把刚才git cherry-p…

小程序给数组遍历赋值,字符串转数组

//res.data你的数组res.data.forEach(function (item, index) {console.log(------->, index); // item.tt item.yixian 就是你要赋值的item.tt that.number(res.data[index].dd)// 字符串转数组split(","); 根据逗号转数组item.yixian res.data[index]…

这段在vue官网能成功运行的代码,在codepen里也没能运行,说vue没被定义Uncaught ReferenceError: Vue is not defined

html <div id"event-handling"><p>{{ message }}</p><button v-on:click"reverseMessage">反转 Message</button> </div>css .demo {font-family: sans-serif;border: 1px solid #eee;border-radius: 2px;padding: …

根据数组给小程序checkbox-group 赋值显示勾选

var tt res.data[0].fuli.split(",");//你数据库保存的数据var s3 [];var array1 ["年终奖","双休","五险","加班补贴","包食宿","有年假","技术培训","提成"] //checkbox 所有…

小程序修改数组参数

//修改数组edit:function (e){//这个参数“e”的具体作用&#xff0c;请参考微信小程序官方提供的说明&#xff0c;地址为https://mp.weixin.qq.com/debug/wxadoc/dev/framework/view/wxml/event.html?t20161107var dataset e.target.dataset; var Index dataset.index; //在…

似乎是好了哎,运行出了Counter: 0,而不是刚才一直的那样,再试一个试试

Counter: 0 试了一下&#xff0c;不行&#xff0c;怎么又变成这个了呢&#xff1f;&#xff1f; 运行出来的 Counter: {{ counter }} 这个运行&#xff0c;不行&#xff0c;不知道为啥 <!DOCTYPE html> <html lang"en"><head><meta charset&…