Home  >  Article  >  Web Front-end  >  How to implement full screen display function in vue.js

How to implement full screen display function in vue.js

王林
王林Original
2021-09-30 14:58:376268browse

Vue.js method to implement full-screen display function: 1. Install vue-fullscreen; 2. Reference and register in main.js; 3. Call the full-screen method, such as [this.$fullscreen.enter(dom , {wrap: false,callback:...].

How to implement full screen display function in vue.js

The operating environment of this article: windows10 system, vue 2.5.2, thinkpad t480 computer.

In actual development, we may encounter situations where we need to display a certain part of the page in full screen. In fact, there are many ways to implement it, but today we only introduce the implementation method based on vue.

The specific steps are as follows:

1. Install vue-fullscreen

Execute the command in the project

‘npm install vue-fullscreen’

2. Reference and register in mian.js

import fullscreen from 'vue-fullscreen'
Vue.use(fullscreen)

3. Specific code implementation:

fullscreen() {
	// 需要全屏显示的dom元素
	let dom = this.$el.querySelector('.videosList')     
        // 调用全屏方法      
        this.$fullscreen.enter(dom, {  
        	wrap: false, 
          	callback: f => {
                	this.fullscreenFlag = f       
          	}     
        })    
 }

Learning recommendation: php training

The above is the detailed content of How to implement full screen display function in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn