- IE不支滑动条在可滑动的状态下自定义宽度和隐藏,
解决方法是:子div宽度加20px 父级overflow:hidden- stylus遇到filter怎么写:
1
filter unquote('progid:DXImageTransform.Microsoft.Alpha(Opacity=' + round(n * 100) + ')'
- stylus遇到filter怎么写:
IE video元素全屏,不能自定义控制条,解决方案是:
采用div全屏的方式1
2
3
4<div>//全屏该div
<video></video>
<div class="controls"></div>
</div>使用getBoundingClientRect获取元素的位置,top只是距离窗口上部的距离,必须加上scrollTop才是准确的高度
1
2
3
4var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
this.$refs.sliTip.style.top = e.target.getBoundingClientRect().top + scrollTop - 70 + "px";
this.$refs.sliTip.style.left = e.target.getBoundingClientRect().left + scrollLeft - 65 + "px";ie支持的渐变
background: linear-gradient(to bottom, #4e2c8d, rgba(78, 44, 141, 0.0))
IE 浏览器遇到symbol未定义的错误
解决方法:
安装babel-polyfillnpm install --save-dev babel-polyfill
页面引入:<script src="node_modules/babel-polyfill/dist/polyfill.min.js"></script>
vue 中用vue-route 打开一个页面
http://ip:port/index/30
在页面中点击一个按钮需要调到http://ip:port/index/40
时,页面不会刷新,不会执行mounted ,可以用下面方法监听$route的变化来解决。1
2
3
4watch: {
// 如果路由有变化,会再次执行fetchdata方法
'$route': 'fetchData'
},fixed 浏览器问题
- 弹出问题
settimeout 和 setInterval 独立于vue组件,因此在销毁组件的时候需要cleanTimeout 和 cleanInterVal
代码示例:1
2
3
4
5
6
7
8
9
10//将所有settimeout 和 setInterval 分别添加到两个数据中,在组件销毁前clean所有
beforeDestroy: function () {
//销毁所有setinterval clearTimeout
for (var i = 0; i < this.timeouts.length; i++) {
clearTimeout(this.timeouts[i])
}
for (var i = 0; i < this.intervals.length; i++) {
clearInterval(this.intervals[i])
}
},图片加载失败的时候的缺省图片问题
1
2
3
4
5
6
7
8//jade
img(:src="honor.name",@error="errorImgFun")
//js 图片加载错误替换该图片
var noImg = require('../../img/index/honor_item_icon.png')
errorImgFun(e){
e.target.src = noImg
},
有最大最小高度的时候使用:absolute 设置最小宽高
- vue router 在IE9下无法使用hash的方式跳转
解决方法router-view(:hashbang="true",:history="true")