2017-05-11 66 views
0

如何在表中添加新行?使用Aurelia.js而不使用jquery。Aurelia.js如何在表中添加新行?沒有使用jquery

將可能做到這一點只與Aurelia.js?

export class App { 
 
    
 
}
<!doctype html> 
 

 
<html> 
 
    <head> 
 
    <title>Aurelia</title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    </head> 
 
    <body aurelia-app> 
 
    <table> 
 
    <tr> 
 
    <td> 
 
     elem 1 
 
    </td> 
 
    <td> elem 2</td> 
 
    <td> elem 3</td> 
 
    <td></td> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    <td></td> 
 
    <td></td> 
 
    <td> 
 
     <button type="button" class="btn btn-info">Add</button> 
 
    </td> 
 
    </tr> 
 
</table> 
 

 
    <script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> 
 
    <script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> 
 
    <script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> 
 
    <script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> 
 
    <script> 
 
     require(['aurelia-bootstrapper']); 
 
    </script> 
 
    </body> 
 
</html>

+3

這是,但你有一個令人難以置信的長途跋涉有一些工作。你有沒有經過[aurelia.io](http://aurelia.io)上提供的教程? – Tom

回答

2

正如thebluefox說,你是從有得工作遠路。你應該閱讀文檔並學習一些基礎知識。

無論如何,你要尋找的答案是:

<tr repeat.for="item of items"> 
    <td>${item.property1}</td> 
    <td>${item.property2}</td> 
    <td>${item.property3}</td> 
    <td>${item.property4}</td> 
</tr> 

現在,每當你推一個物體進入items時間,在表中的新生產線將被創建。

希望這會有所幫助!

相關問題