微信小程序,使用css的颜色渐变透明色时,不同手机系统实现有差异。 当使用渐变透明色时,应该设置为rgba(255,255,255,0)白色透明,避免使用transparent透明属性,这样写法,在不同手机系统,实现会有差异。
split()方法传入正则,可以拆分多个分割符 const list = "apples,bananas;cherries"const fruits = list.split(/[,;]/)console.log(fruits); // 输出结果:["apples", "bananas", "cherries"]
封装Object.prototype.toString.call() function getType(value) { let type = typeof value; if (type !== 'object') { // 如果是基本数据类型,直接返回 return type; } // 如果是引用数据类型,再进一步判断,正则返回结果 return Object.prototype.toString.call(value).replace(/^\[object (\S+)\]$/, '$1');}getTyp.
vue中的hook用法。 定时器的使用方法:这是我们常用的使用定时器的方式export default{ data(){ timer:null }, mounted(){ this.timer = setInterval(()=>{ //具体执行内容 console.log('1'); },1000); } beforeDestory(){ clearInterval(this.timer); this.timer =
computed计算机属性如何实现传参。 // html<div>{{ total(3) }}// jscomputed: { total() { return function(n) { return n * this.num } }, }
watch监听一个对象时,如何排除某些属性的监听 下面代码是,params发生改变就重新请求数据,无论是a,b,c,d属性改变data() { return { params: { a: 1, b: 2, c: 3, d: 4 }, }; },watch: { params: { deep: true, handler() { this.getList; }, }, }.
微信小程序 保存图片功能 uni.authorize({ scope: "scope.writePhotosAlbum", success: (success) => { // 保存图片到本地 this.saveImg() }, fail: (fail) => { uni.getSetting({ success: (setting) => { // 不允许保存 if (settin.
css实现内容滚动,不显示滚动条。 html代码<div class="outer-container"> <div class="inner-container"> ....1111111111111111111111111111111111111111111222222222222222222222222222222222222111111111111111111111111111111111111111111122222222222222222222222.
获取上个月、当前时间和下个月 function getXmonthToday(type) { // type 0 是当天 -1 是上个月 1是下个月 var now = new Date(); // 可以传值调式 now = new Date(2019,2,30); 今天是3月30号 var year = now.getFullYear();//getYear()+1900=getFullYear() var month = now.getMonth() + 1;//0-11表示1-12月 .
vue的$watch方法 mounted() { // 在生命周期函数执行 this.$watch(_=>{ // 满足条件,触发下面的方法 return this.pitchOnUserInfo.FFloor && this.form.orderType },_=>{ this.getGasProductByType() }) },
限制input框只能输入数字的方法 <el-form-item label="默认成本价"> <el-input v-model="costPrice" placeholder="请输入商品默认成本价" type="number" onkeypress="return(/[\d.]/.test(String.fromCharCode(event.keyCode)))" clearable /></el-form-item>加这一句,就能使输入框只输入数字onkeypr...
uniapp进行页面跳转带复杂数据参数时。 1.父页面应该先把数据转成JSON.stringify格式,再传参是用encodeURIComponent()方法编码 // 评价晒单 goEvaluate() { let JSONProductList = JSON.stringify(this.orderInfo.productList) uni.navigateTo({ url: `/pages/product/evaluate?orderId=${this.orderId}&a.