2016-03-02 77 views
0

我有有條件呈現或者是到path鏈路或如果提供的path-disabled方法確定,從而禁用的鏈路跨度的定製組件,所述內部可放置不重要其他類似這樣的使用時,比它的工作原理:Vue js - 如何將此屬性傳遞給循環中的組件?

<li> 
    <conditional-link path="/step/1" :path-disabled="pathDisabled"> 
    <span class="number">1</span> 
    Step one 
    </conditional-link> 
</li> 

但如果我這樣做失敗:

<li v-for="route in stepPaths['/step'].subRoutes"> 
    <conditional-link path="{{route.fullPath}}" :path-disabled="pathDisabled"> 
    <span class="number">{{route.number}}</span> 
    {{route.title}} 

    this outputs correct path: 
    {{route.fullPath}} 

    </conditional-link> 
</li> 

path屬性值是litteral串{{route.fullPath}}

我試過path="route.fullPath"但後來路徑是輸出字符串route.fullPath

如何獲取循環中路徑屬性的路徑值?該變量是正確的,因爲它在組件內部呈現良好。

回答

1

OK很容易因此在任何情況下,其他新手碰上這種情況,必須在V-的對象綁定到能夠直接使用對象:

<li v-for="route in stepPaths" :route="route"> 
    <conditional-link :path="route.fullPath" ... 
相關問題