|
@@ -12,7 +12,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<div v-for="item in imglist" :key="item.name">
|
|
|
- <img :style="carouselImgstyle" :src="item.fileUrl" alt="">
|
|
|
+ <img @click="openDetail(item)" :style="carouselImgstyle" :src="item.fileUrl" alt="">
|
|
|
</div>
|
|
|
</a-carousel>
|
|
|
|
|
@@ -22,7 +22,10 @@
|
|
|
<script setup>
|
|
|
import {onMounted,ref,watch} from 'vue'
|
|
|
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
|
|
|
-
|
|
|
+//定义路由
|
|
|
+import {useRouter,useRoute} from 'vue-router'
|
|
|
+const router=useRouter()
|
|
|
+const route=useRoute()
|
|
|
const imglist = ref([])
|
|
|
|
|
|
const carouselImgstyle = ref({
|
|
@@ -73,7 +76,22 @@ watch(()=>props.carouselList ,(val,oldval)=>{
|
|
|
deep:true
|
|
|
})
|
|
|
|
|
|
+function openDetail (e){
|
|
|
+ //回到顶部
|
|
|
+ const targetElement = document.getElementById('top');
|
|
|
+ if (targetElement) {
|
|
|
+ targetElement.scrollIntoView();
|
|
|
+ }
|
|
|
|
|
|
+ //1=文章,2=外链,空为无跳转
|
|
|
+ if (e?.targetType == '1') {
|
|
|
+ window.open(e?.url, "_blank");
|
|
|
+ }else if (e?.targetType == '2') {
|
|
|
+ //富文本
|
|
|
+ router.push('/CompanyNews?openType=1&id='+e?.articleId + '&bodyType=1&title='+e?.title)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
|
|