vue提醒及错误弹框改变其显示的位置
单页面配置
mounted(){
this.$message.config({
top: '120px',
duration: 2
})
}
全局配置
main.js 进行引入
Vue.prototype.$Message.config({
top: '120px',
duration: 3
});
组件窗口随浏览器窗口随意变动大小
<query-module
:cardInsideWidth = "cardInsideWidth"
>
<temple>......</temple>
</query-module>
**vue 当窗口发生变化时 watch监听并执行**
mounted() {
const that = this
window.onresize = () => {
return (() => {
that.cardInsideWidth = window.innerWidth-50
})()
}
},
watch: {
screenWidth (val) {
this.cardInsideWidth = val
}
}
watch: {
screenWidth (val) {
if (!this.times) {
this.cardInsideWidth = val
this.times = true
let that = this
setTimeout(function(){
console.log(that.cardInsideWidth)
that.times = false
},400)
}
}
}