SecondaryHeading.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. width: 122px;
  54. text-align: center;
  55. height: 60px;
  56. line-height: 60px;
  57. color: #fff;
  58. margin: 0px 70px 0px 31px;
  59. box-sizing:border-box;
  60. margin-top:auto;
  61. font-size:20px;
  62. font-weight:bold;
  63. }
  64. .channel_nav_a_box{
  65. flex:1;
  66. padding:12px 0px;
  67. }
  68. .channel_nav_a {
  69. float: left;
  70. height: 26px;
  71. line-height: 26px;
  72. color: #255590;
  73. font-size: 20px;
  74. margin: 5px 19px;
  75. font-weight: bold;
  76. }
  77. }
  78. </style>