0

我正在尝试传递两个参数,data-no-turbolinks并且mobile

这有效:

(1) %a{href: "#{test_path}", data: { no: { turbolink: true }}} %span Test

这转化为

<a data-no-turbolink href='/test'> <span>Test</span></a>

现在我需要向这个链接添加一个参数:mobile

以下所有方法均无效!

(1)%a{href: "", mobile: 1, data: { no: { turbolink: true }}}

 %a{href: "", data: {mobile: 1, no: { turbolink: true }}}

(turbo-link 正确通过,而不是手机)

(2)%span= link_to "Mobile", {mobile: 1, data: { no: { turbolink: true }}}

(3)%span= link_to "Mobile", {'mobile' => 1, 'data-no-turbolink' => true }

(4)%span= link_to "Mobile", url_for('mobile' => 1, 'data-no-turbolink' => true)

(5) %span= link_to "Mobile", data: {mobile: 1, no: {turbolink: true} }

4

2 回答 2

0
= link_to "Mobile", '#', {"data-mobile" => "1", "data-no-turbolink" => "true"}

哪个输出

<a href="#" data-no-turbolink="true" data-mobile="1">
于 2013-09-12T20:25:31.343 回答
0

我正在使用苗条,我使用解决这个问题

ol data-no-turbolink=true #// here ol is unorders list tag for my case
于 2015-08-26T14:54:50.823 回答