简体   繁体   English

将标记的javascript / json插入咖啡格式

[英]Inserting labeled javascript/json into a coffee format

I am trying to use Flot tooltip in a coffee file, but I am having trouble inserting the necessary labelled javascript/json code into the coffee code. 我正在尝试在咖啡文件中使用Flot工具提示,但是在将必需的带标签的javascript / json代码插入咖啡代码时遇到问题。 I've tried the js2coffee converter tool, but it doesn't seem to work. 我已经尝试过js2coffee转换工具,但是它似乎不起作用。 Here's the code, I am trying to translate into coffee; 这是代码,我正在尝试将其翻译为咖啡; any suggestions? 有什么建议么?

grid:  { hoverable: true }, 
  tooltip: {
    show: true,
    content: "y: %y"
  }

The object can be written in CoffeeScript as follows: 可以使用CoffeeScript编写该对象,如下所示:

somevar =
  grid:
    hoverable: true
  tooltip:
    show: true
    content: 'y: %y'

You can see the conversion to JavaScript live on coffeescript.org 您可以在coffeescript.org上实时观看到JavaScript 的转换

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM