简体   繁体   中英

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. I've tried the js2coffee converter tool, but it doesn't seem to work. 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:

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

You can see the conversion to JavaScript live on coffeescript.org

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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