2017-05-25 26 views
2

由于某些原因,Vue不会为我呈现{{post.title}}{{ post.content }}括号。内容为空(查看下面呈现的html),但v-bind:href="post.url"出于某种原因。我是Vue.js的新手,现在真的很困难。 Backstory: 此代码是Vue即时搜索我的Jekyll博客。Vue.js不显示括号,如{{post.title}}

HTML

<div v-if="articles" class="large-12 columns"> 
    <article v-for="post in itemsSearched" class="article-summary"> 
     <header> 
     <h2><a v-bind:href="post.url">{{post.title}}</a></h2> 
     </header>  
     <p>{{ post.content }}</p>  
     <div class="large-12 column"> 
     <a class="read-more" v-bind:href="post.url">Read More...</a> 
     <div class="middle_line"></div> 
     </div> 
    </article>  
</div> 

渲染HTML

<article class="article-summary"> 
    <header> 
     <h2><a href="/jekyll-update/2017/05/23/welcome-to-jekyll.html"></a></h2> 
    </header> 
    <p></p> 
    <div class="large-12 column"> 
     <a href="/jekyll-update/2017/05/23/welcome-to-jekyll.html" class="read-more">Read More...</a> 
     <div class="middle_line"></div> 
    </div> 
</article> 

回答

3

Jekyll使用double curly braces本身,所以您需要为您的Vue自定义delimiters

new Vue({ 
    delimiters:['<%', '%>'], 
    .... 
}) 

然后用

<% post.title %> 

相反。

你可以定义你想要的任何分隔符,我只是用它们作为例子。