我正在尝试传递两个参数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} }
答案 0 :(得分:0)
= link_to "Mobile", '#', {"data-mobile" => "1", "data-no-turbolink" => "true"}
输出
<a href="#" data-no-turbolink="true" data-mobile="1">
答案 1 :(得分:0)
我正在使用slim,我使用
解决了这个问题ol data-no-turbolink=true #// here ol is unorders list tag for my case