2017-07-16 32 views
1

說我想有一個封裝的內容(又名兒童)組件:使用組件/標籤內容

<article> 
    <header>${input.heading}</header> 
    <section> ... contents come here ... </section> 
<article> 

然後使用它像:

... 
<my-article heading='Test'> 
    Lorem ipsum <s>dolor</s> sit amet 
</my-article> 

怎麼辦我訪問模板中的內容?

回答

1

或者一個簡單的解決方案:

<article> 
    <header>${input.heading}</header> 
    <section><include(input) /></section> 
<article> 

及用途:

<my-article heading='Test'> 
     Lorem ipsum <s>dolor</s> sit amet 
    </my-article> 
1

找到了解決辦法 - <include>可重用/嵌套內容:

<article> 
    <header>${input.heading}</header> 
    <section><include(input.body) /></section> 
</article> 

然後使用它像:

<my-article heading='Hello'> 
    <@body>Lorem ipsum dolor sit <u>amet</u></@body> 
</my-article> 
+0

或者使用''標籤 –

相關問題