大屏项目中如何做全屏

117 阅读1分钟

1.安装依赖

	npm install --save screenfull

2.在需要设置的页面导入

	import screenfull from "screenfull";

3.一个按钮,一个点击事件

      <el-button type="primary" class="button" @click="click">按钮</el-button>
//点击函数
    click() {
      // 判断是否支持
      if (!screenfull.enabled) {
        this.$message({
          message: "不支持全屏",  
          type: "warning"
        });
        return false;
      }
      screenfull.toggle();
    }

走字数走字数走字数走字数走字数走字数走字数走字数