无效的缩进,您可以使用制表符或空格,但不能同时使用两个玉

问题描述 投票:1回答:3

我有以下玉代码,工作正常

div.container
  h3.entry-title(style='margin-top:25px;') #{result.post_title}
  div      
    p.text-left.pst <i class="fa fa-calendar"></i> #{result.post_date}  
  div.panel
     !{result.post_content}
    -if(typeof userType !== 'undefined' && userType=='admin')
        a.btn.red.marginTop(href='/ebs' ) Cancel               

 div.page-footer
    div.page-footer-inner
        Copyright Copyright All rights reserved.  

但是当我尝试插入if语句时,它会给我缩进错误

  div.container
  h3.entry-title(style='margin-top:25px;') #{result.post_title}
  div   
   -if(result.post_date!='-1')  
    p.text-left.pst <i class="fa fa-calendar"></i> #{result.post_date}  
  div.panel
     !{result.post_content}
    -if(typeof userType !== 'undefined' && userType=='admin')
        a.btn.red.marginTop(href='/ebs' ) Cancel               

 div.page-footer
    div.page-footer-inner
        Copyright Copyright  All rights reserved.
node.js pug
3个回答
2
投票

如果您使用的是Sublime文本编辑器,则可以转到“视图”>“缩进”>“将缩进转换为空格”。


3
投票

在编辑器中查找选项以突出显示/显示选项卡或空格。或者只删除所有缩进并仅使用制表符或仅使用空格重新添加它。


0
投票

qazxsw poi模板适用于相同的缩进。

您需要在Pug(formerly Jade)文件中选择space or tab。你不能同时使用它们。

从编辑器中选择常用缩进,然后从这个奇怪的错误中选择

© www.soinside.com 2019 - 2024. All rights reserved.