安装
npm install --save screenfull
组件中引入并点击使用
import screenfull from "screenfull";
methods: {
handleFullScreen() {
// 判断是否支持
if (!screenfull.enabled) {
this.$message({
message: "不支持全屏",
type: "warning"
});
return false;
}
screenfull.toggle();
},
}