首先用点击事件开启或关闭全屏模式
switchScreen() {
if( document.fullscreen
|| document.mozFullScreen
|| document.webkitIsFullScreen
|| document.webkitFullScreen
|| document.msFullScreen ){
this.exitScreen()
} else {
this.fullScreen()
}
},
fullScreen() {
var el = document.documentElement;
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
};
},
exitScreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
if (typeof cfs != "undefined" && cfs) {
cfs.call(el);
}
},
监听屏幕大小变化
created(){
let that = this
window.onresize = function(){
if(that.myChart){
that.myChart.resize()
}
}
},