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

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

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

摘要

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

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

screenfull詳情

點擊圖標 全屏顯示

點擊全屏

再次點擊退出全屏或者Esc 退出

退出

使用方法 npm install screenfull --save

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

API

  • .request(ele) 全屏
  • .exit() 退出全屏
  • .toggle() 切換全屏
  • .on(event, function):event為 ‘change’ | ‘error’ 注冊事件
  • .off(event, function):移除前面已經(jīng)注冊的事件
  • .element: 返回一個全屏的dom節(jié)點,如果沒有就為 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.

總結

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

相關文章

最新評論