欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

VUE項(xiàng)目實(shí)現(xiàn)全屏顯示功能之screenfull用法

 更新時(shí)間:2024年01月25日 10:30:38   作者:Queen_live  
這篇文章主要介紹了VUE項(xiàng)目實(shí)現(xiàn)全屏顯示功能之screenfull用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

摘要

使用screenfull 插件 大多數(shù)開發(fā)項(xiàng)目中都需要全屏顯示功能,在vue項(xiàng)目中有比較方便的插件 screenfull。

npm地址:https://www.npmjs.com/package/screenfull

screenfull詳情

點(diǎn)擊圖標(biāo) 全屏顯示

點(diǎn)擊全屏

再次點(diǎn)擊退出全屏或者Esc 退出

退出

使用方法 npm install screenfull --save

  • 首先安裝 npm install screenfull --save
  • 在使用.vue文件中 引入 import screenfull from 'screenfull'
  • 在按鈕方法中調(diào)用 screenfull.toggle()
  • 還可以檢測(cè)全屏狀態(tài) screenfull.isFullscreen
  • 測(cè)試瀏覽器是否支持全screenfull screenfull.isEnabled

API

  • .request(ele) 全屏
  • .exit() 退出全屏
  • .toggle() 切換全屏
  • .on(event, function):event為 ‘change’ | ‘error’ 注冊(cè)事件
  • .off(event, function):移除前面已經(jīng)注冊(cè)的事件
  • .element: 返回一個(gè)全屏的dom節(jié)點(diǎn),如果沒有就為 null
  • .isFullscreen : 是否是全屏狀態(tài)
  • .isEnabled: 判斷是否支持全屏

兼容性

Note: In order to use this package in Internet Explorer, you need a Promise polyfill.

Note: Safari is supported on desktop and iPad, but not on iPhone. This is a limitation in the browser, not in Screenfull.

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論