代碼正確縮進位置如下,
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 undefined