SecondaryHeading.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <nav class="channel_nav back100">
  3. <a class="channel_nav_a" href="javascript:(void)" title="title">{{ title }}</a>
  4. <span v-for="(item,index) in titleData">
  5. <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" class="channel_nav_a" v-if="index<=7">{{ item.alias }}</NuxtLink>
  6. </span>
  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 {
  46. height: 60px;
  47. width: 1200px;
  48. margin: 0 auto;
  49. background-image: url(@/public/img/5.png);
  50. margin-top: 40px;
  51. .channel_nav_a {
  52. float: left;
  53. height: 60px;
  54. line-height: 60px;
  55. color: #255590;
  56. font-size: 20px;
  57. margin: 0px 19px;
  58. font-weight: bold;
  59. }
  60. >.channel_nav_a:nth-of-type(1) {
  61. color: #fff;
  62. width: 230px;
  63. padding-left: 50px;
  64. box-sizing: border-box;
  65. margin-left:0;
  66. margin-right: 0;
  67. }
  68. }
  69. .back100 {
  70. background-size: 100% 100%;
  71. background-repeat: no-repeat;
  72. }
  73. </style>