如何从与主干路由器的链接中检索数据?例如,
html,
<a href='#!article/edit/about-us/' data-type="post">Edit</a>
骨干,
routes: {
'!article/edit/:url/': 'renderDynamicPage'
},
renderDynamicPage: function (url) {
console.log(url);
var $this = this;
$($this).click(function(){
console.log($this.data("type"));
});
},
结果,
about-us
但我想post
从数据属性中获取。可能吗?