javascript - vue-router 中的 router-link 不能点击
问题描述
<template> <p class='header'> <ul class='firstnav'> <li><h3 class='logo'><img src='https://www.haobala.com/assets/logo.png'><i>CNODEJS</i></h3> </li> <li><router-link to='/'>首页</router-link></li> <li><router-link to='/create'>发表</router-link></li> <li><router-link to='/messages'>消息</router-link></li> <li><router-link to='/userinfo'>我的</router-link></li> <li><router-link to='/about'>关于</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><!-- 渲染结果 --><li>首页</li>
试试
相关文章:
1. python - 求一个在def中可以实现调用本def满足特定条件continue效果的方法(标题说不太清楚,请见题内描述)2. MYSQL新建用户设置可以远程访问的问题3. $fields = $values = [];这条代码一直定义不了,一直报错,老师的源码也是被报错的,执行不了,请问该怎么解决这个问题4. java - mybatis怎么实现在数据库中有就修改,没有就添加5. node.js - nodejs和前端JavaScript 字符串处理结果不一样是什么原因?6. mysql多表联合查询优化的问题7. MySQL中的enum类型有什么优点?8. 数据库 - mysql 远程可以连接,但是本地连接拒绝?9. 数据库设计 - MySQL数据库主键问题10. linux - 为什么我在mysql的my.cnf下找不到bind-address?
![$fields = $values = [];这条代码一直定义不了,一直报错,老师的源码也是被报错的,执行不了,请问该怎么解决这个问题](http://www.haobala.com/attached/image/news/202205/093622cb60.png)