zoukankan      html  css  js  c++  java
  • React `${}` 格式

    //config.js
    module.exports = {
      getAPIPath() {}
    }
    
    import globalConfig from "../config"; 
    `${globalConfig.getAPIPath()}
    
    `` 创建一个字符串 不需要使用字符串连接
    // Current time string
    const time = new Date().toLocaleTimeString();
    // 使用普通字符串(单引号或双引号)时,需要使用字符串连接:
    'Time is ' + time
    // 在使用反引号时,可以使用 ${} 在字符串中注入时间
    `Time is ${time}`
    

      

    serviceNameShow(type, content1) {
      const content = JSON.parse(content1);
      if (type === 0) {
        return content['platformInfo']['name'] + ':' + content['platformInfo']['version'];
      } else if (type === 1) {
        let character = ``;
        JSON.parse(content['serviceMsg']).map(item => {
          character += `<p>${item['serviceName']}:${item['serviceVersion']}</p>`;
        });
        return character;
      } else if (type === 2) {
        const character = `<p>${content['platformInfo']['name']}:${content['platformInfo']['version']}</p>
                          <p>${content['platformInfo']['old']} -> ${content['platformInfo']['version']}</p>`;
        return character;
      } else if (type === 3) {
        const character = `<p>${content['platformInfo']['name']}:${content['platformInfo']['version']}</p>
                          <p>${content['platformInfo']['old']} -> ${content['platformInfo']['replicas']}</p>`;
        return character;
      } else if (type === 4) {
        return content['platformInfo']['name'] + ':' + content['platformInfo']['version'];
      }
    }
  • 相关阅读:
    python cx_Oracle install
    import uno 错误
    webkit report
    window bzr launchpad 安装配置
    如何让同一个字段在不同的view中显示不同的内容
    Trigger model Trigger expr_id in WorkFolow
    how to use a xml_id in field domain
    action 关联
    activity清除的所有方法
    listview加载性能优化ViewHolder
  • 原文地址:https://www.cnblogs.com/zhanglanzuopin/p/12922065.html
Copyright © 2011-2022 走看看