<span @click="narrow()">
		   <svg class="fulls-iconfont" aria-hidden="true">
		     <use xlink:href="#bi-cancel-full-screen"></use>
		   </svg>
	   </span>
	   <span @click="enlarge()">
		   <svg class="fulls-iconfont" aria-hidden="true">
		     <use xlink:href="#bi-full-screen"></use>
		   </svg>
	   </span>

enlarge() {
		var dom= document.getElementById('canvas')
		if (dom.requestFullscreen) {
			dom.requestFullscreen()
		} else if (dom.mozRequestFullScreen) {
			dom.mozRequestFullScreen()
		} else if (dom.webkitRequestFullscreen) {
			dom.webkitRequestFullscreen()
		} else if (dom.msRequestFullscreen) {
			dom.msRequestFullscreen()
		}
		this.flag= true
	}

	narrow() {
		if (!this.flag) return
		document.exitFullscreen()
		this.flag= false
	}

 

Logo

前往低代码交流专区

更多推荐