1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| <template>
| <div style="height: 100%;">
| <!-- 判断是否在空白页打开 -->
| <template v-if="!isOneself">
| <div class="app-wrapper">
| </div>
| </template>
| <!-- 如果在空白页打开则不显示框架 -->
| <template v-else>
| <AppContent />
| </template>
| </div>
| </template>
|
| <script>
| import AppContent from './components/AppContent.vue'
| export default {
| data() {
| return {
| // 默认页面在框架内显示
| isOneself: false,
| // 获取当前页面名称
| nowRouteName: '',
| }
| },
| components: {
| AppContent,
| },
| mounted() {
| // 设置标题
| this.setNowRouteName(this.$route)
| // 初始化加载一次判断是否在空白页打开
| this.isOneself = this.$route.meta.oneself
| },
| methods: {
| // 获取当前页面标题
| setNowRouteName(route) {
| this.nowRouteName = route.meta.title
| },
| },
| watch: {
| // 监听route变化
| $route: function (newVal) {
| this.setNowRouteName(newVal)
| // 判断页面是否在空白页打开
| this.isOneself = newVal.meta.oneself
| },
| },
| }
| </script>
|
| <style lang="less" scoped></style>
|
|