This commit is contained in:
liuyalei 2023-12-07 23:35:03 +08:00
parent f00c5fa731
commit ebf4875221
2 changed files with 10 additions and 23 deletions

View File

@ -11,40 +11,26 @@ import sl2 from './assets/s6.png'
import sl3 from './assets/s7.png'
import sl4 from './assets/s8.png'
import { useRoute, useRouter } from 'vue-router'
// const route = useRoute()
// let routePath = ref(route.path)
const route = useRoute()
let routePath = ref(route.path)
const router = useRouter()
let bt_data = reactive([{ btname: '优惠服务', imgurl: s1, simgurl: sl1 ,path:'/'}, { btname: '生活助手', imgurl: s2, simgurl: sl2 ,path:'/chat'}, { btname: '智能优推', imgurl: s3, simgurl: sl3,path:'/znyt' }, { btname: '大众点评', imgurl: s4, simgurl: sl4 ,path:'/comment'}])
let bt_data = reactive([{ btname: '优惠服务', imgurl: s1, simgurl: sl1, path: '/' }, { btname: '生活助手', imgurl: s2, simgurl: sl2, path: '/chat' }, { btname: '智能优推', imgurl: s3, simgurl: sl3, path: '/znyt' }, { btname: '大众点评', imgurl: s4, simgurl: sl4, path: '/comment' }])
let selctdeNum = ref(0)
let clickNum = (num,path) => {
let clickNum = (num, path) => {
selctdeNum.value = num
routePath.value = path
router.push(path)
}
</script>
<template>
<!-- <header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header> -->
<!-- <RouterLink to="/chat">Chat</RouterLink> -->
<RouterView />
<div class="bottom">
<div class="bt_itm" v-for="(v, i) in bt_data" :key="i" @click="clickNum(i,v.path)">
<img v-if="selctdeNum != i" :src="v.imgurl" alt="">
<div class="bt_itm" v-for="(v, i) in bt_data" :key="i" @click="clickNum(i, v.path)">
<img v-if="routePath != v.path" :src="v.imgurl" alt="">
<img v-else :src="v.simgurl" alt="">
<span :class="{ slectedfont: selctdeNum == i }">{{ v.btname }}</span>
<span :class="{ slectedfont: routePath == v.path }">{{ v.btname }}</span>
</div>
</div>
</template>
@ -68,6 +54,7 @@ let clickNum = (num,path) => {
width: 100vw;
// border: 1px solid red;
padding: 9px 0px;
.bt_itm {
display: flex;
flex-direction: column;

View File

@ -257,7 +257,7 @@
<div class="c_bottom">
<img src="../assets/3.png">
<input v-model="inputText" type="text" placeholder="有问题尽管问我~" class="sendinput" />
<input v-model="inputText" type="text" placeholder="有问题尽管问我~" @keydown.enter="sendMessage" class="sendinput" />
<div class="w_icon">
<img src="../assets/4.png" alt="">
</div>