Commit b0939304 authored by 张伯涛's avatar 张伯涛

点击首页banner跳转链接

parent d98137e4
......@@ -35,6 +35,15 @@
"path": "pages/topic/detail",
"style": {}
},
{
"path" : "pages/webview/webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/myArticle/index",
"style": {
......
......@@ -9,14 +9,13 @@
<!-- </view>-->
<!-- </u-col>-->
<u-col>
<view bindtap="navigateToPage">
<u-swiper
:list="topicList"
indicator
indicatorMode="line"
circular
@click="navigateToPage"
></u-swiper>
</view>
</u-col>
</u-row>
<view style="padding-bottom: 30rpx;">
......@@ -99,6 +98,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
components: {USwiper, UCol},
data() {
return {
linkUrl: '',
unitId: '',
pic1,
pic2,
......@@ -106,6 +106,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
activeNav: 0,
newList: [],
hotList: [],
topicItemList: [],
topicList: [
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
......@@ -144,13 +145,13 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
this.queryTopic();
},
navigateToPage(e) {
// 获取点击的u-swiper组件的索引
const index = e.currentTarget.dataset.index;
// 根据索引或其他逻辑确定跳转的页面
const link = this.topicList[index].url;
// 执行页面跳转
wx.navigateTo({
url: link,
console.log('1111',e)
this.linkUrl = this.topicItemList[e].linkUrl
this.$u.route({
url: '/pages/webview/webview',
params: {
linkUrl: this.linkUrl
}
});
},
sectionChange(index) {
......@@ -223,9 +224,11 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
// item.img = baseApi + '/file/getImgStream?idFile=' + item.article.img;
// }
if(list.records && list.records.length > 0) {
this.topicItemList = list.records
this.topicList = list.records.map(item => item.url)
} else {
this.topicList = []
this.topicItemList = []
}
})
},
......
<template>
<web-view :src="webUrl"></web-view>
</template>
<script>
export default {
name: "webview",
data() {
return {
webUrl: ''
};
},
onLoad(option) {
console.log('11111',option)
this.webUrl = option.linkUrl
},
methods: {
}
}
</script>
<style scoped>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment