SOURCE

console 命令行工具 X clear

                    
>
console
// 初始化轻服务实例
var myService = new BCloud({
  serviceId: 'tt553695rb86t93m68',
});

// 测试服务
$('#invoke').click(function() {
  var fnName = 'hello'; // 函数名称

  // 调用轻服务函数
  myService.run(fnName)
  .then(function(data) {
    // 处理正常结果
    console.log(data.message);
    $('#res').show();
    $('#result').html(JSON.stringify(data));
  })
  .catch(function(error) {
    // 处理异常结果
    console.log(error);
    alert('调用出错')
  });
});
<p>轻服务 Hello World 示例</p>

<button id="invoke">调用</button>
<button id="reinvoke">再次调用</button>

<div id="res">
  <p>调用成功:</p>
  <p id="result"></p>
</div>
#res {
  display: none;
}

#reinvoke {
  display: none;
}

button {
  background-color: #fff;
  border: 0;
  border-radius: 2px;
  box-shadow: none;
  color: #1a73e8;
  cursor: pointer;
  display: inline-block;
  font: 500 14px/20px Roboto,sans-serif;
  height: 36px;
  margin: 0;
  min-width: 36px;
  outline: 0;
  overflow: hidden;
  padding: 8px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  text-transform: uppercase;
  transition: background-color .2s,box-shadow .2s;
  vertical-align: middle;
  white-space: nowrap;
  background-color: #039be5;
  color: #fff;
}

本项目引用的自定义外部资源