1. 程式人生 > >layui.laytpl中js方法書寫及呼叫:去除html標籤

layui.laytpl中js方法書寫及呼叫:去除html標籤

 1 <script type="text/html" id="conTpl">
 2  
 3     {{# 
 4         var delhtml = function(str) {
 5             return str.replace(/&lt;[^>].*?&gt;/g, '');
 6         }
 7     }}
 8     
 9     {{delhtml(d.contant)}}
10    
11 </script>