需要获取值数组并在ts中进行比较

时间:2018-03-06 06:33:15

标签: typescript

在这里,我得到一个值,我比较......但我需要得到数组值,然后处理 找到它

import { compile } from '../../src/index';
 
let customHelper: Object = {
  upperCase: (str: string) => {
    return str.toUpperCase();
  }
};
 
let data: object = { value: 20 };
 
let getDOMString: (data: object) => HTMLCollection = compile(
  '<div>' +
  '${if(value >= 10)}' +
  '<span> Value > Than 10 </span>' +
  '${else if(value === 10)}' +
  '<span> Value EqualTo 10 </span>' +
  '${else}' +
  '<span> Value < 10 </span>' +
  '${/if}' +
  '</div>',
  customHelper);
 
let opElem: HTMLCollection = getDOMString(data);
 
document.getElementById('element').appendChild(opElem[0]);

需要获取值数组并进行比较

0 个答案:

没有答案