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