hookehuyr

fix 产品菜单新增遮罩效果

1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:36:06 2 * @Date: 2024-09-26 13:36:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-18 18:58:31 4 + * @LastEditTime: 2024-10-24 14:58:49
5 * @FilePath: /hager/src/App.vue 5 * @FilePath: /hager/src/App.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <div style="display: flex; flex-direction: column; min-height: 100vh; overflow: hidden;"> 9 <div style="display: flex; flex-direction: column; min-height: 100vh; overflow: hidden;">
10 - <hager-header></hager-header> 10 + <hager-header @onShowMenu="onShowMenu"></hager-header>
11 <router-view :class="[!isLoginPage ? 'wrapper' : '', is_xs ? 'xs' : '']"></router-view> 11 <router-view :class="[!isLoginPage ? 'wrapper' : '', is_xs ? 'xs' : '']"></router-view>
12 <hager-footer v-if="!isLoginPage"></hager-footer> 12 <hager-footer v-if="!isLoginPage"></hager-footer>
13 + <div v-if="showMask" class="mask">
14 + </div>
13 </div> 15 </div>
14 </template> 16 </template>
15 17
...@@ -23,7 +25,7 @@ export default { ...@@ -23,7 +25,7 @@ export default {
23 mixins: [mixin.init], 25 mixins: [mixin.init],
24 data () { 26 data () {
25 return { 27 return {
26 - 28 + showMask: false
27 } 29 }
28 }, 30 },
29 computed: { 31 computed: {
...@@ -37,7 +39,9 @@ export default { ...@@ -37,7 +39,9 @@ export default {
37 39
38 }, 40 },
39 methods: { 41 methods: {
40 - 42 + onShowMenu (val) {
43 + this.showMask = val;
44 + },
41 } 45 }
42 } 46 }
43 </script> 47 </script>
...@@ -82,6 +86,18 @@ body { ...@@ -82,6 +86,18 @@ body {
82 // } 86 // }
83 // } 87 // }
84 88
89 +.mask {
90 + position: fixed;
91 + top: 0;
92 + left: 0;
93 + width: 100%;
94 + height: 100%;
95 + background-color: rgba(0, 0, 0, 0.5);
96 + display: flex;
97 + justify-content: center;
98 + align-items: center;
99 +}
100 +
85 .global-center { 101 .global-center {
86 position: relative; 102 position: relative;
87 top: 50%; 103 top: 50%;
......
1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-24 11:20:47 4 + * @LastEditTime: 2024-10-24 14:34:58
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
47 </el-col> 47 </el-col>
48 <el-col :sm="1" :md="1" :lg="3" :xl="4">&nbsp;</el-col> 48 <el-col :sm="1" :md="1" :lg="3" :xl="4">&nbsp;</el-col>
49 </el-row> 49 </el-row>
50 - <el-row class="hidden-xs-only" style="background-color: #fff; border-top: 1px solid rgba(218, 218, 218, 0.4);"> 50 + <el-row class="hidden-xs-only" :style="{backgroundColor: '#fff', borderTop: '1px solid rgba(218, 218, 218, 0.4)', borderBottom: show_border ? '1px solid rgba(218, 218, 218, 0.4)' : ''}">
51 <el-col :sm="1" :md="1" :lg="3" :xl="4">&nbsp;</el-col> 51 <el-col :sm="1" :md="1" :lg="3" :xl="4">&nbsp;</el-col>
52 <el-col :sm="22" :md="22" :lg="18" :xl="16" style="position: relative;height: 5rem;"> 52 <el-col :sm="22" :md="22" :lg="18" :xl="16" style="position: relative;height: 5rem;">
53 <el-row> 53 <el-row>
...@@ -155,12 +155,30 @@ export default { ...@@ -155,12 +155,30 @@ export default {
155 // choose_country: false, // 主动选择了国家地区 155 // choose_country: false, // 主动选择了国家地区
156 keyword: '', 156 keyword: '',
157 is_login: true, 157 is_login: true,
158 + show_border: false,
158 } 159 }
159 }, 160 },
160 watch: { 161 watch: {
161 // 监听路由参数变化时,更新输入框的值 162 // 监听路由参数变化时,更新输入框的值
162 '$route.query.keyword': function(newKeyword) { 163 '$route.query.keyword': function(newKeyword) {
163 this.keyword = newKeyword || ''; 164 this.keyword = newKeyword || '';
165 + },
166 + '$route' (to, from) {
167 + this.is_active = to.meta.tag;
168 + this.show = false;
169 + if (to.path.indexOf('/product') !== -1 || to.path.indexOf('/about') !== -1) {
170 + this.show_border = true;
171 + } else {
172 + this.show_border = false;
173 + }
174 + },
175 + 'is_xs' (val) {
176 + if (!val) {
177 + $('body').css('overflow', 'auto');
178 + }
179 + },
180 + 'show' (val) {
181 + this.$emit('onShowMenu', val)
164 } 182 }
165 }, 183 },
166 async mounted () { 184 async mounted () {
...@@ -196,17 +214,6 @@ export default { ...@@ -196,17 +214,6 @@ export default {
196 // 214 //
197 215
198 }, 216 },
199 - watch: {
200 - '$route' (to, from) {
201 - this.is_active = to.meta.tag;
202 - this.show = false;
203 - },
204 - 'is_xs' (val) {
205 - if (!val) {
206 - $('body').css('overflow', 'auto');
207 - }
208 - },
209 - },
210 methods: { 217 methods: {
211 splitProductList (products) { 218 splitProductList (products) {
212 const maxLength = 5; // 超过5个需要拆分 219 const maxLength = 5; // 超过5个需要拆分
......