小程序参数获取 1、简单的分享onLoad(options) { const id = options.id;}2、海报分享【简易版】// 假设 scene=1,2,3onLoad(param) { const str = decodeURIComponent(param.scene); // 注意这里拿到的是一个字符串 console.log(str.split(',')); // ['1','2','3']}3、海报分享【对象版】// 假设 scene='id=1&
JS 的双击事件 单击var el = document.getElementById('el')el.onclick = function () { alert('单击!!!')}双击var el = document.getElementById('el')el.ondblclick = function () { alert('双击!!!')}但是,遇到需要单击和双击同时存在时,js 效果会冲突。解决如下:var el = document.getElementBy
js验证身份证号是否有效 function testid(id) { // 1 "验证通过!", 0 //校验不通过 var format = /^(([1][1-5])|([2][1-3])|([3][1-7])|([4][1-6])|([5][0-4])|([6][1-5])|([7][1])|([8][1-2]))\d{4}(([1][9]\d{2})|([2]\d{3}))(([0][1...
使用定位居中图片 #scene_phone_content img{ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 100%; }
css 省略号 省略号样式 带控制行数 overflow: hidden;text-overflow:ellipsis;display: -webkit-box;-webkit-line-clamp: 2; //显示内容的行数-webkit-box-orient: vertical;
h5中placeholder的字体颜色和输入进去的不一样 解决办法:.login_form_item_input_box::-webkit-input-placeholder{ color: #ccc;}
根元素 font-size 的改变,带来的问题 原始的 rem ,是这样计算的。rem 值 = px值 / 16(浏览器 font-size 默认值);为了更好的使用 rem ,我们要设置文档根元素的 font-size 值(通常是 font-size = 100px)。html{ font-size: 100px;}此时 rem 的计算方法是:px 值 / 100 (此时浏览器的根元素 font-size = 100px)...
学习了koa项目中使用REST的问题及解决思路总结 问题一:组织url 通过url中的开头来解决,/static/表示静态资源,/api/表示rest api 通过子域名区分 问题二:统一输出 区分REST API 和 非REST API 绑定一个rest()方法,设置得有ctx.response.type = "application/json" ctx.response.b...
curl传输json数据 curl -H 'Content-Type: application/json' -X POST -d '{"name":"XBox","price":3999}' http://localhost:3000/api/products在linux上可以此代码运行。windows时,注意:1、有两处 ‘ 符号,需要改为 "2、Content-Type: applicati...
vuex 在购物车中通过+添加商品时数量一直是2时的建议 如果购物车的存储方式为json数组,那么很可能是因为调用mapMutation修改num时传入的参数是通过mapState获取的数据。解决办法:在data中创建一个新的对象:objectdata () { return { object: { id: Number, name: '', imgUrl: '', ...