简体   繁体   中英

Setting other attributes in loop rivets js

I have a loop like this in revets.js:

<ul>
    <li rv-each-article="main_content.latest_articles">
        <p rv-on-click="controller.onArticleClick" rv-text="article.title" 
        data-url="article.url"></p>
    </li>
</ul>

Unfortunately article.url is not being parsed by revets.js so the when logging the value to the console it just prints article.url while I expect it to get the actual value from the data object and print that out.

How do I fix this?

Just prefix data-url with rv- like:

<ul>
  <li rv-each-article="main_content.latest_articles">
    <p rv-on-click="controller.onArticleClick" rv-text="article.title" 
    rv-data-url="article.url"></p>
  </li>
</ul>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM