如何在jade模板中的javascript中居文本?

时间:2016-06-21 14:25:33

标签: javascript pug

enter image description here我已从查询中检索具有以下内容的变量:

geneModel = [
    {
        x: 35,
        y: 55, 
        description: "CC", 
        id: "CC"
    },
    {
        x: 122, 
        y: 142, 
        description: "CC", 
        id: "CC"
    },
    {
        x: 3, 
        y: 14, 
        description: "TIR", 
        id: "TIR"
    }
]

我想在输出中居中描述字段,但我不知道如何在模板jade中的javascript代码中执行此操作。

我附上了以下代码:

 body(role='document')

  .row.jumbotron
    h3
      strong Gene model
         #div1.col-md-10.col-md-offset-1(style='margin-top: 0px')
      script.
         var FeatureViewer = require("feature-viewer");
         //Create a new Feature Viewer and add some rendering options
         window.onload = function() {
         //Create a new Feature Viewer and add some rendering options
         var ft2 = new FeatureViewer("...", {
         showAxis: true,
         showSequence: true,
         brushActive: true,
         toolbar:true,
         bubbleHelp:true,
         zoomMax:10
         });
         //Add some features        
         ft2.addFeature({
         data: "#{geneModel}",
         name: "Domains",
         className: "test4",
         color: "#F4D4AD",
         type: "rect",
         height: 30,
         filter: "type1",
         style: "align-center"
         });
         };

0 个答案:

没有答案