question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`v-el` on child vm's non-root element

See original GitHub issue
<ul id="app">
    <li v-repeat="items" v-el="item">
        <span>{{text}}</span> <button v-el="itemBtn">x</button>
    </li>
</ul>

vm.$$.item works well and returns a node list, but vm.$$.itemBtn returns undefined, should it returns a node list?

Demo here: http://jsfiddle.net/Alexorz/efwLrcd3/

v0.11.0-rc3

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Alexorzcommented, Oct 29, 2014

this.$$.item is an array of DOM element, man… but achieved that through v-ref.

Code:

<ul id="app">
    <li v-repeat="items" v-ref="itemVM">
        <span>{{text}}</span> <button v-el="itemBtn">x</button>
    </li>
</ul>
var buttons = this.$.itemVM.map(function (itemVM) {
  return itemVM.$$.itemBtn
});

Is it possible to make this.$$.itemBtn as a shortcut of this.$.itemVM.map(function (item) { return item.$$.itemBtn });?

1reaction
yyx990803commented, Oct 29, 2014

This is because every item in v-repeat is a vm, so the itemBtn is registered on the child vm instead.

You can do

var buttons = this.$$.item.map(function (item) {
  return item.$$.itemBtn
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can Jaxb marshal child elements without the root element?
I'm currently not able to do so as the marshaller yells that I do not have a @XmlRootElement defined. We're actually trying to...
Read more >
[Solved]-v-model and child components?-Vue.js - appsloveworld
To implement the v-model directive for a custom component: ... the $attrs instance property and can be explicitly bound to a non-root element...
Read more >
Untitled
Guam japanese restaurant, Nicolas janavel, Calling out your name lyrics foals, ... Sony music apk no root, Spooling definition biology, Bo jio pic,...
Read more >
Lecture III BALANCED SEARCH TREES - NYU Computer Science
Russians Adel'son-Vel'skii and Landis in 1962, and are called AVL trees. ... Assume u is a non-root node in a binary search tree...
Read more >
How to Deploy Laravel Project with Apache on Ubuntu
Install Composer On Ubuntu. There are a few steps that we can follow to deploy Laravel on Apache. The first one is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found