我有一个由jsx创建的导航栏,如下所示。
请参阅href="/users/<%= user.username %>
。
import React from 'react';
import { Navbar, Nav, NavItem, Glyphicon, NavDropdown, MenuItem } from 'react-bootstrap';
const navbarInstance = (
<Navbar inverse>
<Navbar.Header>
<Navbar.Toggle>
<Glyphicon className="glyphicon" glyph="align-justify" />
</Navbar.Toggle>
<Navbar.Brand>
<a href=".">Some brand name</a>
</Navbar.Brand>
</Navbar.Header>
<Navbar.Collapse>
<Nav className="nav">
<NavItem eventKey={1} href="/users/<%= user.username %>">My Page</NavItem>
<NavItem eventKey={2} href="#">Forum</NavItem>
<NavItem eventKey={3} href="./status">Status</NavItem>
<NavItem eventKey={4} href="#">Donate</NavItem>
</Nav>
<Nav pullRight>
<NavDropdown eventKey={5} title="Account">
<MenuItem eventKey="5.1" href="./edit">My Page Setup</MenuItem>
<MenuItem eventKey="5.2" href="./logout">Log Out</MenuItem>
</NavDropdown>
</Nav>
</Navbar.Collapse>
</Navbar>
);
export default navbarInstance;
当我点击“我的页面”时,浏览器会显示"Failed to decode param '%3C%=%20user.username%20%%3E'"
。
我也使用webpack和express.js.
我怎样才能解决这个问题?