小编Jul*_* W.的帖子

使用API​​.AI在Slack上进行多语言集成

我已经用API.AI制作了一个机器人,并且正在Slack中使用它。我正在尝试将多语言代理集成到其中,但是我不知道如何设置来自Slack的消息的lang标记。

我的机器人支持英语和法语,即使用户用法语设置了Slack,lang标记仍为“ EN”(英语)。

先感谢您

multilingual slack-api slack dialogflow-es

5
推荐指数
0
解决办法
143
查看次数

从检查的输入中获取标签

我想.text()从选中的输入中获取标签。实际上,我的代码检查是否检查了输入,然后从每个<li>具有相同类的对象(不仅是检查的对象)中获取标签。我该如何实现?我认为我应该使用.parent()或.child()属性,但我不知道如何使用。

我尝试过alert($('#myId input').parent('label').text());但没有成功。

Codepen https://codepen.io/Qasph/pen/LyNJev?editors=1010

$('#result').click(function() {
  // If an input is checked
  if ($('#myId input').is(':checked')) {
    // Get text from label parent
    console.log($('#myId label').text());
  } else {}
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="myId">
  <ul>
    <!-- First class -->
    <li class="myFirstClass"><label><input type="checkbox" value="3">1 - First class</label></li>
    <li class="myFirstClass"><label><input type="checkbox" value="6">2 - First class</label></li>
    <!-- Second class -->
    <li class="mySecondClass"><label><input type="checkbox" value="3">1bis - Second class</label></li>
    <li class="mySecondClass"><label><input type="checkbox" value="6">2bis - Second class</label></li>
  </ul>
</div>
<button id="result">Result</button>
Run Code Online (Sandbox Code Playgroud)

jquery

3
推荐指数
1
解决办法
1447
查看次数

使用未解析的标识符'kCAFillModeForwards'

当我尝试设置animation.fillMode = kCAFillModeForwardsXcode时无法编译并显示错误." 使用未解析的标识符'kCAFillModeForwards'".

我已经在以前的项目中使用过这个没有任何问题,有人已经遇到过这种行为吗?

func animateGradient() {
        currentGradient += 1
        let animation = CABasicAnimation(keyPath: Animation.keyPath)
        animation.duration = animationDuration
        animation.toValue = currentGradientSet()
        animation.fillMode = kCAFillModeForwards
        animation.isRemovedOnCompletion = false
        animation.delegate = self
        gradient.add(animation, forKey: Animation.key)
}
Run Code Online (Sandbox Code Playgroud)

xcode animation cabasicanimation caanimation swift

3
推荐指数
1
解决办法
2168
查看次数