Skip to content

Commit 5a8755e

Browse files
committed
add screenfull
1 parent 3a2bf13 commit 5a8755e

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"mockjs": "1.0.1-beta3",
2626
"normalize.css": "3.0.2",
2727
"nprogress": "0.2.0",
28+
"screenfull": "3.2.2",
2829
"showdown": "1.7.1",
2930
"simplemde": "1.11.2",
3031
"sortablejs": "1.5.1",

src/components/Screenfull/index.vue

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<template>
2+
3+
<svg @click='click' class="icon screenfull" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" t="1497503607356" viewBox="0 0 1024 1024" version="1.1" p-id="4109" :fill='fill' :width="width" :height="height"><path d="M604.157933 512l204.484208 204.484208 82.942037-82.942037c10.364045-10.952446 26.498514-13.83817 40.309054-8.067746 13.249769 5.742794 22.465664 18.99154 22.465664 33.977859l0 258.042008c0 20.168342-16.695241 36.863582-36.863582 36.863582L659.452283 954.357873c-14.986319 0-28.236088-9.215896-33.977859-23.025413-5.770424-13.249769-2.885723-29.384237 8.067746-39.748283l82.942037-82.942037L512 604.157933 307.515792 808.642141l82.942037 82.942037c10.952446 10.364045 13.83817 26.498514 8.067746 39.748283-5.742794 13.809517-18.99154 23.025413-33.977859 23.025413L106.504686 954.357873c-20.168342 0-36.863582-16.695241-36.863582-36.863582L69.641103 659.452283c0-14.986319 9.215896-28.236088 23.025413-33.977859 13.249769-5.770424 29.384237-2.8847 39.748283 8.067746l82.942037 82.942037 204.484208-204.484208L215.357859 307.515792l-82.942037 82.942037c-6.890944 6.918573-16.10684 10.952446-25.911136 10.952446-4.593622 0-9.804297-1.14815-13.83817-2.8847-13.809517-5.742794-23.025413-18.99154-23.025413-33.977859L69.641103 106.504686c0-20.168342 16.695241-36.863582 36.863582-36.863582L364.546693 69.641103c14.986319 0 28.236088 9.215896 33.977859 23.025413 5.770424 13.249769 2.8847 29.384237-8.067746 39.748283l-82.942037 82.942037 204.484208 204.484208L716.484208 215.357859l-82.942037-82.942037c-10.952446-10.364045-13.83817-26.498514-8.067746-39.748283 5.742794-13.809517 18.99154-23.025413 33.977859-23.025413l258.042008 0c20.168342 0 36.863582 16.695241 36.863582 36.863582l0 258.042008c0 14.986319-9.215896 28.236088-22.465664 33.977859-4.593622 1.736551-9.804297 2.8847-14.397918 2.8847-9.804297 0-19.020192-4.033873-25.911136-10.952446l-82.942037-82.942037L604.157933 512z" p-id="4110"/></svg>
4+
</template>
5+
6+
<script>
7+
import screenfull from 'screenfull';
8+
export default {
9+
name: 'hamburger',
10+
props: {
11+
width: {
12+
type: Number,
13+
default: 22
14+
},
15+
height: {
16+
type: Number,
17+
default: 22
18+
},
19+
fill: {
20+
type: String,
21+
default: '#48576a'
22+
}
23+
},
24+
data() {
25+
return {
26+
isFullscreen: false
27+
}
28+
},
29+
methods: {
30+
click() {
31+
if (!screenfull.enabled) {
32+
this.$message({
33+
message: 'you browser can not work',
34+
type: 'warning'
35+
});
36+
return false;
37+
}
38+
39+
if (this.isFullscreen) {
40+
screenfull.exit();
41+
this.isFullscreen = false;
42+
} else {
43+
screenfull.request();
44+
this.isFullscreen = true;
45+
}
46+
}
47+
}
48+
}
49+
</script>
50+
51+
<style scoped>
52+
.screenfull {
53+
display: inline-block;
54+
cursor: pointer;
55+
vertical-align: -0.15em;
56+
}
57+
</style>

src/views/layout/Navbar.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<el-menu class="navbar" mode="horizontal">
3-
<Hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></Hamburger>
3+
<hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
44
<levelbar></levelbar>
55
<error-log v-if="log.length>0" class="errLog-container" :logsList="log"></error-log>
6-
6+
<screenfull class='screenfull'></screenfull>
77
<el-dropdown class="avatar-container" trigger="click">
88
<div class="avatar-wrapper">
99
<img class="user-avatar" :src="avatar+'?imageView2/1/w/80/h/80'">
@@ -30,14 +30,16 @@
3030
import { mapGetters } from 'vuex';
3131
import Levelbar from './Levelbar';
3232
import Hamburger from 'components/Hamburger';
33+
import Screenfull from 'components/Screenfull';
3334
import ErrorLog from 'components/ErrLog';
3435
import errLogStore from 'store/errLog';
3536
3637
export default {
3738
components: {
3839
Levelbar,
3940
Hamburger,
40-
ErrorLog
41+
ErrorLog,
42+
Screenfull
4143
},
4244
data() {
4345
return {
@@ -80,6 +82,12 @@
8082
position: absolute;
8183
right: 150px;
8284
}
85+
.screenfull{
86+
position: absolute;
87+
right: 90px;
88+
top: 16px;
89+
color: red;
90+
}
8391
.avatar-container {
8492
height: 50px;
8593
display: inline-block;

0 commit comments

Comments
 (0)