vue使用screenfull插件實(shí)現(xiàn)全屏功能
本文實(shí)例為大家分享了vue使用screenfull插件實(shí)現(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' :src='http://www.lshqa.cn/bcjs/require(’@/assets/images/screenful.png’)' : :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 : :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)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. Java封裝數(shù)組實(shí)現(xiàn)包含、搜索和刪除元素操作詳解2. 淺談SpringMVC jsp前臺獲取參數(shù)的方式 EL表達(dá)式3. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)4. Gitlab CI-CD自動化部署SpringBoot項目的方法步驟5. python基于socket模擬實(shí)現(xiàn)ssh遠(yuǎn)程執(zhí)行命令6. Django-migrate報錯問題解決方案7. JAVA上加密算法的實(shí)現(xiàn)用例8. 使用Python和百度語音識別生成視頻字幕的實(shí)現(xiàn)9. idea打開多個窗口的操作方法10. ASP中解決“對象關(guān)閉時,不允許操作。”的詭異問題……
