javascript - vue-router 中的 router-link 不能點擊
問題描述
<template> <p class='header'> <ul class='firstnav'> <li><h3 class='logo'><img src='http://m.4tl426be.cn/assets/logo.png'><i>CNODEJS</i></h3> </li> <li><router-link to='/'>首頁</router-link></li> <li><router-link to='/create'>發(fā)表</router-link></li> <li><router-link to='/messages'>消息</router-link></li> <li><router-link to='/userinfo'>我的</router-link></li> <li><router-link to='/about'>關(guān)于</router-link></li> </ul> </p></template><script type='text/ecmascript-6'>export default { name: ’header’,}</script><!-- Add 'scoped' attribute to limit CSS to this component only --><style lang='css' scoped> ul{ list-style-type: none } .header{ /*box-shadow: 0 0 1px rgba(0,0,0,0.25);*/ box-shadow: 0 1px 4px #ccc; font-size: 15px; background: #fff; position: fixed; width: 100%; top:0; /*min-width: 1000px;*/ } .firstnav{ display:block; width: 1000px; padding:0; margin: 0 auto; } .firstnav>li { float: left; display: inline-block; height: 50px; margin: 10px 0; } .firstnav>li>a{ line-height: 50px; padding:5px 10px; margin: 0 10px; /*border-bottom: 2px solid #41B883;*/ } .firstnav>li>a:hover{ /*border-bottom: 2px solid #41B883;*/ background: #F3F3F3; border-radius: 2px; } .logo{ margin: 0 100px 0 0; color: #41B883; } .logo img{ display: inline-block; width: 50px; height: 50px; }</style>
問題解答
回答1:<router-link :to='' tag='li'></router-link>可以不要<li>了
回答2:把<li><router-link to='/'>首頁</router-link></li>改成
<router-link to='/' tag='li'>首頁</router-link><!-- 渲染結(jié)果 --><li>首頁</li>
試試
相關(guān)文章:
1. python - 我在使用pip install -r requirements.txt下載時,為什么部分能下載,部分不能下載2. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處3. node.js - nodejs開發(fā)中常用的連接mysql的庫4. 網(wǎng)頁爬蟲 - python 爬取網(wǎng)站 并解析非json內(nèi)容5. mysql - jdbc的問題6. Python爬蟲如何爬取span和span中間的內(nèi)容并分別存入字典里?7. 視頻文件不能播放,怎么辦?8. mysql - 如何減少使用或者不用LEFT JOIN查詢?9. python - 編碼問題求助10. linux - python 抓取公眾號文章遇到驗證問題
