我有一个简单的菜单,想显示登录名和其他帐户的链接。
我确定我可以使用此功能,但是对js文件进行一些更改后,该功能将不再可用。
我知道它会很简单,但是无法弄清楚。非常感谢您的帮助。
<script type="text/javascript">
if ( MageCustomer.name !== undefined ) {
$( '.mm-account' ).removeClass( 'hide' ).find( '.name' ).text( MageCustomer.name );
} else {
$( '.mm-login' ).removeClass( 'hide' );
}
</script>
<ul>
<li class="mm-login hide"><a href="{{config path=" web/unsecure/base_url "}}customer/account/login">Login/Join</a>
</li>
<li class="mm-account hide"><a href="{{config path=" web/unsecure/base_url "}}customer/account">My Account (<span class="name green"></span>)</a>
</li>
<li class="mm-account hide"><a href="{{config path=" web/unsecure/base_url "}}customer/account/logout">Logout</a>
</li>
<li><a href="{{config path=" web/unsecure/base_url "}}ordering-information">Ordering Information</a>
</li>
<li><a href="{{config path=" web/unsecure/base_url "}}shipping-options">Delivery Info</a>
</li>
<li><a href="{{config path=" web/unsecure/base_url "}}terms-and-conditions">Free Returns</a>
</li>
<li><a href="{{config path=" web/unsecure/base_url "}}contacts">Contact Us</a>
</li>
<li><a href="{{config path=" web/unsecure/base_url "}}faq">FAQ</a>
</li>
</ul>
控制台错误是这个。
Uncaught TypeError: Cannot read property 'removeClass' of null at eval (eval at
<anonymous> (prototype.js?v=1.0.19:612),
<anonymous>:5:15) at prototype.js?v=1.0.19:612 at prototype.js?v=1.0.19:865 at prototype.js?v=1.0.19:825 at Array.forEach (
<anonymous>) at Array.each (prototype.js?v=1.0.19:824) at Array.collect (prototype.js?v=1.0.19:864) at String.evalScripts (prototype.js?v=1.0.19:612) at Function.
<anonymous> (prototype.js?v=1.0.19:391) at prototype.js?v=1.0.19:416