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>

 

posted @ 2018-12-08 09:35  dirgo  阅读(2589)  评论(0编辑  收藏  举报