How to template If-Else structures in data-bound views?

后端 未结 4 975
陌清茗
陌清茗 2020-12-12 20:01

I constantly find myself using this idiom in KO-based HTML templates:




        
4条回答
  •  余生分开走
    2020-12-12 20:44

    One approach is to use named templates (which can support passing arguments):

    
    
    
    

    Another option is use my switch/case plugin, which would work like this:

    
        
            
        
        
            
        
    
    

提交回复
热议问题