一、安装依赖
cnpm install screenfull@4.2.0 --save
二、代码
import screenfull from "screenfull";
<el-button type="primary" @click="click">进入全屏</el-button>
click() {
if (!screenfull.enabled) {
this.$message({
message: "不支持全屏",
type: "warning"
});
return false;
}
screenfull.toggle();
},
三、效果