![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
前端实践
The dream is near
这个作者很懒,什么都没留下…
展开
-
小程序websocket上下行代码整理
js:websocket(简称ws)连接,上下行方法//app.jsglobalData: { task: null //ws连接后的task对象}//index.jscount: 0,//记录ws连接次数isReceive: false, //判断是否获取下行信息connectWebsocket() { var that = this // 存储连接后的task对象 存到全局,保持连接 var task = wx.connectSocket({原创 2021-03-17 10:58:53 · 336 阅读 · 0 评论 -
vue背景图片底下留白 如何充满全屏
底下留白解决方法:因为我是全局背景都是这张图片,因此直接在app.vue写样式#app{height: 100%;background: url(img/timg.jpg) no-repeat;background-size: 100% 100%;background-attachment:fixed;}原创 2020-09-17 17:29:26 · 982 阅读 · 0 评论 -
vue template报错:Component template should contain exactly one root element
原因:template底下只能有一个元素,多个会报错<template> <button @click="jump">返回</button> <div>公告</div> </template>解决方法:在最外层加一层div即可<template> <div class="notice"...原创 2020-04-16 11:32:44 · 163 阅读 · 0 评论 -
Navigating to current location ("/user") is not allowed"
错误原因:点击的所要跳转的路由和当前是相同的。如果没有向router.push提供回调,错误只会发送到全局路由器错误处理程序。现在,因为推送和替换都返回一个承诺,如果导航失败(任何取消导航的操作,如next(false)或next(’/other ')也计算在内)没有被捕获,您将在控制台中看到一个错误,因为该承诺拒绝没有被捕获。解决方法:重写push方法,加上catch函数this.$rou...原创 2020-04-11 14:10:38 · 459 阅读 · 0 评论 -
el-table内的表格开启validate表单验证后,报 type check failed for prop "data". data.indexOf is not a function错
原因:el-table内不能存在有obejct类型的数据,需要转成数组或其他格式。如果需要提交obejct类型的表单,可在验证表单成功后再自行将数组转换成obejct类型。...原创 2020-04-09 19:40:45 · 676 阅读 · 0 评论 -
vue使用echarts-legend-icon自定义图标路径错误问题
除了static文件夹,图片放在其他文件夹都会被webpack构建,如改成base64的格式。因此js就会找不到图片路径。因此,如果要正确引入图片有以下几种方法:1、使用require,使用如图正确路径所示方式展示。icon:('image://'+require("../../../assets/images/driveless/right/right_img7.png")+'')...原创 2019-11-06 14:36:41 · 1228 阅读 · 0 评论 -
10月21日-25日学习播客总结(vue vuex axios vue-router flex布局)
10月21日-22日1、vue-router学习https://www.jianshu.com/p/06d08ea39e312、vue2.0中的$router 和 $route的区别https://www.cnblogs.com/czy960731/p/9288830.html3、axioshttps://www.jianshu.com/p/f438914a2437http...原创 2019-10-23 15:27:10 · 113 阅读 · 0 评论 -
当position为absolute时,盒子如何居中定位
样式:1、页面居中 position: absolute; left: 0; right: 0; top:0; bottom: 0; margin: auto;2、垂直居中 position: absolute; top:0; bottom: 0; margin: auto;3、水平居中 position: absol...原创 2019-09-02 23:22:34 · 1443 阅读 · 0 评论 -
点击div以外让div消失的方法及绑定body点击事件直接触发的解决方法
利用 $.contains()函数比较当前点击元素是否包含在div内。如我们要让class为all_introducitons的模块在点击其他位置时消失,我们可以设置body的点击事件,当点击时判断当前点击的元素,即event.target,然后contains()函数就会判断,如果包含则返回true,不包含则返回false。 <div class="all_introductions"...原创 2019-08-29 16:39:41 · 1059 阅读 · 3 评论 -
swiper点击按钮轮播失效,按F12弹出编辑器后才有效的解决方法
因为我给swiper-slide内的元素进行了样式的添加修改,所以导致swiper初始化失败,因此在js内添加observer和observeParents参数便可。var mySwiper = new Swiper ('.swiper-container', { direction: 'horizontal', // 垂直切换选项 loop:false, noSw...原创 2019-08-29 15:17:26 · 1606 阅读 · 5 评论 -
z-index失效原因
1、body内有其他div的z-index比当前div的大。2、z-index没有配合position使用举例:实现全屏半黑状态 加定位前:.blackground{ position: fixed; background: rgba(0,0,0,0.59); width:100%; height:100%; z...原创 2019-08-28 19:03:02 · 151 阅读 · 0 评论