全屏(Fullscreen)
有些时候,你希望你的网站或应用程序全屏运行。
通过封装Web Fullscreen API,Quasar可以轻松实现。
请注意,由于Web Fullscreen API还没有固定的Web标准,因此行为有所不同,具体取决于运行代码的平台。
安装
编辑 /quasar.conf.js
:
framework: { plugins: ['AppFullscreen'] }
|
基础用法
import { AppFullscreen } from 'quasar'
(Boolean) AppFullscreen.isCapable
(Boolean) AppFullscreen.isActive
AppFullscreen.request()
AppFullscreen.exit()
AppFullscreen.toggle()
|
(Boolean) this.$q.fullscreen.isCapable
(Boolean) this.$q.fullscreen.isActive
this.$q.fullscreen.request()
this.$q.fullscreen.exit()
this.$q.fullscreen.toggle()
|
例子
观察全屏更改:
// vue文件 <template>...</template>
<script> export default { watch: { '$q.fullscreen.isActive' (val) { console.log(val ? 'In fullscreen now' : 'Exited fullscreen') } } } </script>
|