如何使用InlineViewStrategy进行撰写视图工作

时间:2017-04-09 19:46:02

标签: aurelia

我正在尝试在InlineViewStrategy中获得一个conpose视图。

简单,"硬编码"自定义模板中的表视图在更高级别div标签(" x_content")的上下文中工作,如下面传入InlineViewStrategy的供应商维护支出所示

    '                   <table class="" style="width:100%">',
    '                      <tr>',
    '                         <th style="width:37%;">',
    '                            <p>Top 5</p>',
    '                         </th>',
    '                         <th>',
    '                            <div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">',
    '                              <p class="">Vendor</p>',
    '                            </div>',
    '                            <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">',
    '                              <p class="">Progress</p>',
    '                            </div>',
    '                          </th>',
    '                       </tr>',
    '                       <tr>',
        '                          <td>',
        '                              <canvas id="canvas1" height="140" width="140" style="margin: 15px 10px 10px 0"></canvas>',
        '                          </td>',
        '                          <td>',
        '                             <table class="tile_info">',
        '                                 <tr>',
        '                                   <td>',
        '                                        <p><i class="fa fa-square blue"></i>Vendor 1 </p>',
        '                                   </td>',
        '                                   <td>30%</td>',
        '                                 </tr>',
    '                              </table>',
        '                           </td>',
    '                        </tr>',
    '                    </table>',

The data in Vendor Spend Maintain

如果我尝试将相同的内容(逐字包含模板)放在html文件(即test-view.html)中,并在test-view.html上进行撰写,用compose和PASSING THAT替换HTML InLoneViewStrategy,我得到一个空白屏幕

    <compose view="./test-view.html"> </compose>

我进入控制台,&#34;未处理的拒绝错误:模块的加载超时:template-registry-entry!test-view.html,text!test-view.html&#34;。我还应该在其他地方放置这个test-view.html吗?或者我错过了什么?

    to be more specific
 [
 ' ... '
 '            <div class="x_content">           ',
 '       HTMLTABLE STUFF ',
 '            </div>                            ' 
 ' ...         ].join( " ")

取代

   [
   ' ... '
   '            <div class="x_content">           ',
   '  <compose view="./test-view.html"> </compose>',
   '            </div>                            ' 
   ' ...         ].join( " ")

在自定义模板中,然后传递给InlineViewStrategy

先谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

test-view.html has to be in the relevant directory... in this case , at src level

相关问题