猿问

如何给:url形式的链接里传参数?

var group_id=1;

var href = "{:url('projects/group/project_distribute_layer',['id'=>group_id])}";


此时,group_id不是变量,而是常量字符串“group_id”。


后来,

我用"{:url('projects/group/project_distribute_layer',['id'=>"+group_id+"])}"


也不行。


RISEBY
浏览 368回答 2
2回答

婷婷同学_

var group_id=1;var href = `projects/group/project_distribute_layer?id=${group_id}`;望采纳

缥缈止盈

var title = encodeURI($('.search-value').val());window.location.href = basePath + "help/list?title="+title;
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答