hookehuyr

解决方案跳转操作新增,页面滚动重置

1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-26 10:46:21 4 + * @LastEditTime: 2024-09-30 16:23:36
5 - * @FilePath: /vite-project/src/router.js 5 + * @FilePath: /hager/src/router.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import Vue from 'vue' 8 import Vue from 'vue'
...@@ -15,7 +15,11 @@ const router = new VueRouter({ ...@@ -15,7 +15,11 @@ const router = new VueRouter({
15 history: false, 15 history: false,
16 hashbang: true, 16 hashbang: true,
17 base: '/', 17 base: '/',
18 - routes: ConfigRouter 18 + routes: ConfigRouter,
19 + scrollBehavior(to, from, savedPosition) {
20 + // 每次路由切换后,页面滚动到顶部
21 + return { x: 0, y: 0 };
22 + }
19 }) 23 })
20 24
21 router.beforeEach((to, from, next) => { 25 router.beforeEach((to, from, next) => {
......
1 <!-- 1 <!--
2 * @Date: 2024-08-27 10:06:30 2 * @Date: 2024-08-27 10:06:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-30 16:14:48 4 + * @LastEditTime: 2024-09-30 16:21:59
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -49,18 +49,7 @@ ...@@ -49,18 +49,7 @@
49 <hager-box class="box-2n"> 49 <hager-box class="box-2n">
50 <hager-h1 title="解决方案" sub="Solution"></hager-h1> 50 <hager-h1 title="解决方案" sub="Solution"></hager-h1>
51 <div class="hager-solution"> 51 <div class="hager-solution">
52 - <div class="solution-item"><p>住宅解决方案</p></div> 52 + <div @click="goToSolution(item)" class="solution-item" v-for="(item, index) in 10" :key="index"><p>住宅解决方案</p></div>
53 - <div class="solution-item"><p>商建解决方案</p></div>
54 - <div class="solution-item"><p>工建解决方案</p></div>
55 - <div class="solution-item"><p>供电局解决方案</p></div>
56 - <div class="solution-item"><p>发电解决方案</p></div>
57 - <div class="solution-item"><p>石油石化解决方案</p></div>
58 - <div class="solution-item"><p>冶金解决方案</p></div>
59 - <div class="solution-item"><p>电子解决方案</p></div>
60 - <div class="solution-item"><p>通信解决方案</p></div>
61 - <div class="solution-item"><p>算力解决方案</p></div>
62 - <div class="solution-item"><p>交通解决方案</p></div>
63 - <div class="solution-item other">Other解决方案</div>
64 </div> 53 </div>
65 </hager-box> 54 </hager-box>
66 <hager-box class="box-n"> 55 <hager-box class="box-n">
...@@ -175,6 +164,11 @@ export default { ...@@ -175,6 +164,11 @@ export default {
175 this.$router.push({ 164 this.$router.push({
176 path: '/news/detail' 165 path: '/news/detail'
177 }); 166 });
167 + },
168 + goToSolution (v) {
169 + this.$router.push({
170 + path: '/solution/detail'
171 + });
178 } 172 }
179 } 173 }
180 } 174 }
......
...@@ -5,67 +5,7 @@ ...@@ -5,67 +5,7 @@
5 <hager-h1 title="行业解决方案" sub="Industry Solutions" style="margin: 2rem 0;"></hager-h1> 5 <hager-h1 title="行业解决方案" sub="Industry Solutions" style="margin: 2rem 0;"></hager-h1>
6 <div> 海格电气产品已广泛应用于电子产品制造业,为其供配电系统稳定、可靠的运行提供可靠保障。 </div> 6 <div> 海格电气产品已广泛应用于电子产品制造业,为其供配电系统稳定、可靠的运行提供可靠保障。 </div>
7 <div class="hager-industry-solutions"> 7 <div class="hager-industry-solutions">
8 - <div class="card"> 8 + <div @click="goToSolution(item)" class="card" v-for="(item, index) in 10" :key="index">
9 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
10 - <div class="card-content">
11 - <div style="display: flex; align-items: center; justify-content: space-between;">
12 - <span>住宅解决方案</span>
13 - <i class="el-icon-right"></i>
14 - </div>
15 - <p>Residential Solution Case</p>
16 - </div>
17 - </div>
18 - <div class="card">
19 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
20 - <div class="card-content">
21 - <div style="display: flex; align-items: center; justify-content: space-between;">
22 - <span>住宅解决方案</span>
23 - <i class="el-icon-right"></i>
24 - </div>
25 - <p>Residential Solution Case</p>
26 - </div>
27 - </div>
28 - <div class="card">
29 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
30 - <div class="card-content">
31 - <div style="display: flex; align-items: center; justify-content: space-between;">
32 - <span>住宅解决方案</span>
33 - <i class="el-icon-right"></i>
34 - </div>
35 - <p>Residential Solution Case</p>
36 - </div>
37 - </div>
38 - <div class="card">
39 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
40 - <div class="card-content">
41 - <div style="display: flex; align-items: center; justify-content: space-between;">
42 - <span>住宅解决方案</span>
43 - <i class="el-icon-right"></i>
44 - </div>
45 - <p>Residential Solution Case</p>
46 - </div>
47 - </div>
48 - <div class="card">
49 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
50 - <div class="card-content">
51 - <div style="display: flex; align-items: center; justify-content: space-between;">
52 - <span>住宅解决方案</span>
53 - <i class="el-icon-right"></i>
54 - </div>
55 - <p>Residential Solution Case</p>
56 - </div>
57 - </div>
58 - <div class="card">
59 - <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
60 - <div class="card-content">
61 - <div style="display: flex; align-items: center; justify-content: space-between;">
62 - <span>住宅解决方案</span>
63 - <i class="el-icon-right"></i>
64 - </div>
65 - <p>Residential Solution Case</p>
66 - </div>
67 - </div>
68 - <div class="card">
69 <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image"> 9 <img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" alt="学校图片" class="card-image">
70 <div class="card-content"> 10 <div class="card-content">
71 <div style="display: flex; align-items: center; justify-content: space-between;"> 11 <div style="display: flex; align-items: center; justify-content: space-between;">
...@@ -98,7 +38,11 @@ export default { ...@@ -98,7 +38,11 @@ export default {
98 38
99 }, 39 },
100 methods: { 40 methods: {
101 - 41 + goToSolution (v) {
42 + this.$router.push({
43 + path: '/solution/detail'
44 + });
45 + }
102 } 46 }
103 } 47 }
104 </script> 48 </script>
......