2017-06-06 12 views
0

現在、私のVueはコンポーネントをレンダリングしていますdnaMoleculeFileInfo。独自の小道具でレンダリングする別のコンポーネントを追加するにはどうすればよいですか?複数の.vueコンポーネントをレンダリングする

var app = new Vue({ 
    el: '#app', 
    render: h => h(dnaMoleculeFileInfo, { 
     props: { 
      format: data.dnamoleculefile.format, 
      id: data.dnamoleculefile.id, 
      name: data.dnamoleculefile.name, 
      sequence: data.sequence.bases, 
      sequenceLength: data.length 
     } 
    }) 
}) 
+0

次の2つのコンポーネントが必要な場合は、子としてコンテナと二つの成分をレンダリングする必要があります。 – Bert

答えて

4

このようなものです。

console.clear() 
 

 
const dnaMoleculeFileInfo = { 
 
    template:`<h2>I'm a dnaMoleculeFileInfo</h2>` 
 
} 
 

 
const someOtherComponent = { 
 
    template:`<h2>I'm some other component</h2>` 
 
} 
 

 
var app = new Vue({ 
 
    el: '#app', 
 
    render(h){ 
 
     // Add the props you want to these two components 
 
     const dna = h(dnaMoleculeFileInfo) 
 
     const other = h(someOtherComponent) 
 
     // return a container with both of them as children 
 
     return h("div", [dna, other]) 
 
    } 
 
})
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script> 
 
<div id="app"></div>

関連する問題