vue使用screenfull插件實現(xiàn)全屏功能
更新時間:2020年09月17日 09:50:17 作者:lt要努力
這篇文章主要為大家詳細介紹了vue使用screenfull插件實現(xiàn)全屏功能,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了vue使用screenfull插件實現(xiàn)全屏功能的具體代碼,供大家參考,具體內(nèi)容如下
1、安裝screenfull.js插件(在npm官網(wǎng)上有)
npm install screenfull --save
2、在vue項目中 src/components/ScreenFull/index.vue(寫成公共組件)
<template> <el-tooltip effect="dark" content="全屏" placement="bottom"> <img @click="screen" class="pointer" :src="require('@/assets/images/screenful.png')" :width="width" :height="height"> </el-tooltip> </template> <script> import screenfull from 'screenfull' export default { name: 'screenful', components: { }, props: { width: { type: Number, default: 20 }, height: { type: Number, default: 20 } }, data() { return { } }, computed: { }, watch: { }, methods: { screen() { if (!screenfull.isEnabled) { this.$message({ message: 'you browser can not work', type: 'warning' }) return false } screenfull.toggle() } }, created() { }, mounted() { } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="less" scoped> </style>
3、使用screenful組件
<template> <screenfull class="ml64" :width="20" :height="20"></screenfull> </template> <script> import screenfull from '@/components/ScreenFull' export default { name: 'navbar', components: { screenfull }, data() { return { } }, computed: { }, watch: { }, methods: { }, created() { }, mounted() { } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="less" scoped> </style>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
element?plus如何為表格某列數(shù)據(jù)文字設(shè)置顏色樣式
實習工作需要根據(jù)表格的狀態(tài)字段來設(shè)置列的樣式,所以這篇文章主要給大家介紹了關(guān)于element?plus如何為表格某列數(shù)據(jù)文字設(shè)置顏色樣式的相關(guān)資料,需要的朋友可以參考下2023-10-10vue中el-checkbox全選、反選、多選的實現(xiàn)
這篇文章主要介紹了vue中el-checkbox全選、反選、多選的實現(xiàn)方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-05-05vue使用neovis操作neo4j圖形數(shù)據(jù)庫及優(yōu)缺點
這篇文章主要介紹了vue使用neovis操作neo4j圖形數(shù)據(jù)庫,本文給大家介紹了與常規(guī)做法的優(yōu)缺點對比及使用技巧,對vue?neo4j圖形數(shù)據(jù)庫相關(guān)知識感興趣的朋友一起看看吧2022-02-02