SecondaryHeading.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <nav class="channel_nav_box">
  3. <a class="channel_nav_head" href="javascript:(void)" title="title">{{ title }}</a>
  4. <div class="channel_nav_a_box clearfix">
  5. <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" class="channel_nav_a" v-for="item in titleData">{{ item.alias }}</NuxtLink>
  6. </div>
  7. </nav>
  8. </template>
  9. <script setup>
  10. //1.设置组件数据 start---------------------------------------->
  11. //子导航
  12. const props = defineProps({
  13. titleData:Array,
  14. pinyinid:Number
  15. });
  16. //获取当前url路径
  17. const route = useRoute();
  18. //获得当前的完整路径
  19. const fullPath = route.path;
  20. const segments = fullPath.split('/');
  21. const targetSegment = segments[1];
  22. //1.设置组件数据 end---------------------------------------->
  23. //2.设置组件标题 start ---------------------------------------->
  24. const title = ref("")
  25. async function getPageData() {
  26. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  27. method: 'GET',
  28. query: {
  29. 'catid': props.pinyinid,
  30. },
  31. });
  32. if(mkdata.code == 200){
  33. title.value = mkdata.data.alias;
  34. }else{
  35. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  36. console.log("错误位置:获取二级标题")
  37. console.log("后端错误反馈:",mkdata.message)
  38. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  39. }
  40. }
  41. getPageData();
  42. //2.设置组件标题 end ---------------------------------------->
  43. </script>
  44. <style lang="less" scoped>
  45. .channel_nav_box {
  46. display:flex;
  47. width: 1200px;
  48. margin: 0 auto;
  49. background: url(http://img.bjzxtw.org.cn/master/www/snscw/5.png) no-repeat bottom;
  50. background-size:100% auto;
  51. margin-top: 40px;
  52. .channel_nav_head {
  53. height: 60px;
  54. line-height: 60px;
  55. color: #fff;
  56. margin: 0px 70px 0px 31px;
  57. box-sizing:border-box;
  58. margin-top:auto;
  59. font-size:20px;
  60. font-weight:bold;
  61. }
  62. .channel_nav_a_box{
  63. flex:1;
  64. padding:12px 0px;
  65. }
  66. .channel_nav_a {
  67. float: left;
  68. height: 26px;
  69. line-height: 26px;
  70. color: #255590;
  71. font-size: 20px;
  72. margin: 5px 19px;
  73. font-weight: bold;
  74. }
  75. }
  76. </style>