如何在Aurelia中将变量调用为另一个变量?

时间:2018-08-09 03:17:24

标签: aurelia aurelia-binding

<ul if.bind="imageSizes">
  <li repeat.for="type of types">
    <a href="#">(${ imageSizes.${type} }px)</a>
  </li>
</ul>

我尝试使用中继器复制以下代码:

<li if.bind="imageSizes.original">
  <a href="#"> (${ imageSizes.original }px)</a>
</li>
<li if.bind="imageSizes.largeweb">
  <a href="#"> (${ imageSizes.largeweb }px)</a>
</li>
<li if.bind="imageSizes.web">
  <a href="#"> (${ imageSizes.web }px)</a>
</li>
<li if.bind="imageSizes.tab">
  <a href="#"> (${ imageSizes.tab }px)</a>
</li>
<li if.bind="imageSizes.mobile">
  <a href="#"> (${ imageSizes.mobile }px)</a>
</li>
<li if.bind="imageSizes.thumb">
  <a href="#"> (${ imageSizes.thumb }px)</a>
</li>

是否可以在这里使用类似${imageSizes.${type}}px的东西?

1 个答案:

答案 0 :(得分:0)

正确的格式是

<ul if.bind="imageSizes">
  <li repeat.for="type of types" if.bind="imageSizes[type]">
    <a href="#">(${imageSizes[type]})px</a>
  </li>
</ul>

哪个是我的问题?

    Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.