代碼正確縮進位置以下,spa
extend "layout" block 'content',-> div ->'nihao' script id:"InvoiceItem",type:"text/template",style:"display: none",-> div ->"{{price}}" div ->"{{quantity}}" div ->"{{amount}}" coffeescript -> $ -> invoiceItemModel = new InvoiceItemModel({price:5,quantity:3}) (new PreviewInvoiceItemView({el:'body',model:invoiceItemModel})).render()
緣由:引用了extend "layout"模板之後,要操做當前頁面的代碼,應該放在當前頁面代碼的內部,放在外部是訪問不到的,因此報錯:Uncaught TypeError: Cannot read property 'replace' of undefinedcode