JavaScript VueJs: Focus on Input using v-el Directive inside v-repeat Directive vuejs focus input on load,vuejs focus input,vuejs focus

I display a list by using the v-repeat directive.

http://jsfiddle.net/ftc9ev7p/1/

Please notice the dynamically created argument of the v-el directive, which is made of

v-el="inputField{{task.id}}" 

or alternatively

v-el="{{'inputField' + task.id }}"

Still it doesn't get recognized, since I get:

Uncaught TypeError: Cannot read property 'focus' of undefined

I want to click the edit button and have the according input field focused on.

A similar syntax works, when I dynamically add a css class. Just uncomment the line with the .focus() and click "edit".

		new Vue({
		  el: '#tasks',

		  data: {
		    "tasks": [{
		      "id": 25,
		      "body": "Slack Noooo Yes",
		      "completed": true,
		      "created_at": "2015-08-05 17:00:26",
		      "updated_at": "2015-08-05 17:00:26"
		    }, {
		      "id": 27,
		      "body": "And",
		      "completed": false,
		      "created_at": "2015-08-05 17:22:14",
		      "updated_at": "2015-08-05 17:22:14"
		    }, {
		      "id": 28,
		      "body": "Happiness",
		      "completed": false,
		      "created_at": "2015-08-05 17:22:16",
		      "updated_at": "2015-08-05 17:22:16"
		    }, {
		      "id": 29,
		      "body": "Love",
		      "completed": true,
		      "created_at": "2015-08-06 07:45:02",
		      "updated_at": "2015-08-06 07:45:02"
		    }],

		    newTask: ''
		  },

		  methods: {
		    editTask: function(task) {

		      var inputField = 'inputField' + task.id;
		      alert(inputField);

		      var self = this;
		      self.$$.inputField.focus();

		      document.querySelector(".task" + task.id).className += " edit";
		    }
		  }
		});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.8/vue.min.js"></script>
<table class="table" id="tasks">
  <thead>
    <tr>
      <th>Task</th>
      <th>Edit</th>
      <th>Options</th>
    </tr>
  </thead>
  <tbody>
    <tr v-repeat="task: tasks">
      <td class="todo">
        <span class="task{{ task.id }}" v-on="dblclick: editTask(task)">
						{{ task.body }}
					</span>
      </td>
      <td>
        <input type="text" class="editInputField" v-el="inputField{{ task.id }}" value="{{ task.body }}" v-on="keyup:editTask(task) | key 'enter'">
      </td>
      <td>
        <button class="btn btn-xs btn-primary" v-on="click: editTask(task)">Edit</button>
      </td>
    </tr>
  </tbody>
</table>
Answer:1

I'm trying to perform the same encryption operation in Java (using Bouncy Castle) and Node.js, however I receive different results in each language. Below are my attempted implementations - can anyone ...

I'm trying to perform the same encryption operation in Java (using Bouncy Castle) and Node.js, however I receive different results in each language. Below are my attempted implementations - can anyone ...

  1. expecting different results when

Here's a solution i found on stackoverflow this solution works for me except that when the contents of the div is overflown the contents do not scroll alongside the arrow keys, like scroll seems to ...

Here's a solution i found on stackoverflow this solution works for me except that when the contents of the div is overflown the contents do not scroll alongside the arrow keys, like scroll seems to ...

  1. using arrow keys in excel
  2. using arrow keys in javascript
  3. using arrow keys in python
  4. using arrow keys in java
  5. using arrow keys in excel not working
  6. using arrow keys to navigate excel
  7. using arrow keys to move between cells in excel
  8. using arrow keys to move objects in visio
  9. using arrow keys in processing
  10. using arrow keys in c++
  11. using arrow keys in illustrator
  12. using arrow keys to scroll in excel
  13. using arrow keys in vim
  14. using arrow keys in selenium webdriver
  15. using arrow keys as mouse
  16. using arrow keys in scratch
  17. using arrow keys in html
  18. using arrow keys for gaming
  19. using arrow keys in vi editor
  20. using arrow keys in vba

I am following this example for making a custom editable <span> using ngModelController: https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#example What I want to do now is to be ...

I am following this example for making a custom editable <span> using ngModelController: https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#example What I want to do now is to be ...

I have made a dropdown that appears on click on a button. Pretty simple, except for how I have to click twice to get the js function to execute. After I click it the first, it appears and disappears ...

I have made a dropdown that appears on click on a button. Pretty simple, except for how I have to click twice to get the js function to execute. After I click it the first, it appears and disappears ...

  1. having to click twice on everything
  2. having to click mouse twice