2016-09-26 20 views
0

我得到一個錯誤:當我通過這個字符串到func參數.html.eex文件中錯誤與多行字符串裏面渲染功能

missing terminator: " (for string starting at line 36) 

<%= render ProjectName.SnippetView, "doc_ready.html", 
     func: "if (smallScreen() == 'true') { 
       if ($(document).height() > 750) {         <%#(2a)%> 
        $('.scrollTop.main').css({'display': 'flex'}) 
       } 
       }" 
%> 

我已經嘗試過在每行的末尾使用""" """,\,並使用<>連接每個字符串行(在每行的開頭和末尾使用"),但沒有成功。

回答

1

您應該刪除這部分:<%#(2a)%>

或者,如果你試圖內插值字符串,請使用#{}符號。 <% %>僅適用於.eex模板的HTML部分。