使用Ember动态加载和操作文档

时间:2015-07-19 18:02:08

标签: ember.js dynamic

我正在an app concept工作,想知道Ember是否适合这项任务。

我想从SVG与单个SVG文档之间的关系描述。

程序需要动态加载文档,并在它们的末尾递归插入。

所以,从像这样的对象:

[
  {
    id: 1,
    image: 'base.svg',
    contains: [
      {
        id: 2,
        position: { x: 50, y: 50 },
        size: { width: 35, height: 35 }
      },
      {
        id: 3,
        position: { x: 150, y: 150 },
        size: { width: 40, height: 40 }
      }
    ]
  },
  {
    id: 2,
    image: 'kitchen.svg'
  },
  {
    id: 3,
    image: 'den.svg',
    contains: [ {
      id: 4,
      position: { x: 25, y: 25 },
      size: { width: 10, height: 10 }
    } ]
  },
  {
    id: 4,
    image: 'tv.svg'
  }
]

到页面/areas/1,如:

<html><body>
  <svg from='base.svg'>
    <!-- Contents of base.svg -->
    <a xlink:href='/areas/2'>
      <svg from='kitchen.svg' x='50' y='50' width='35' height='35'>
        <!-- Contents of kitchen.svg -->
      </svg>
    </a>
    <a xlink:href='/areas/3'>
      <svg from='den.svg' x='150' y='150' width='45' height='45'>
        <!-- Contents of den.svg -->
        <a xlink:href='/areas/4'>
          <svg from='tv.svg' x='25' y='25' width='10' height='10'>
            <!-- Contents of tv.svg -->
          </svg>
        </a>
      </svg>
    </a>
  </svg>
</body></html>

0 个答案:

没有答案