M
M
Michael2017-08-20 11:58:06
Vue.js
Michael, 2017-08-20 11:58:06

How to use v-bind vue.js?

Hello, there is a following task.
In the table in each row there is a button that should open the full information about the data in the row.
The data is received by ajax and shown in a modal window. When requesting, you need to pass 3 parameters. Here is the question.
Button code

<td style="text-align:center;">
       <input type="button" id="show-modal"
                 class="Insp"
                 v-bind:name="{{order.mod.real|safeseq}}"
                 text="{{order.mod.port}}"
                 test="{{order.mod.id}}"
                 @click="open" value="Открыть">
 </td>

I get data from the button like this
var self = this
self.selecIP = event.target.name

If you apply v-bind to "text" and "test" and get data in the same way, then the data is not written and, naturally, is not transmitted.
The question is, is it possible to use more than one v-bind for one element?
And how do I get the data I need?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Kalinin, 2017-09-29
@kentovsky

more than one bind is:
v-bind:attr1="value1":attr2="value2":attr2="value2":attr4="value4"...

A
Alexey Shashenkov, 2017-08-20
@teknik2008

<td style="text-align:center;">
       <input type="button" id="show-modal"
                 class="Insp"
                 v-bind:name="{{order.mod.real|safeseq}}"
                 text="{{order.mod.port}}"
                 test="{{order.mod.id}}"
                 @click="open(order.mod.real|safeseq)" value="Открыть">
 </td>

methods:{
  open(name){
    var self = this
    self.selecIP=name
  }
}

E
Evgeny Kulakov, 2017-08-20
@kulakoff Vue.js

It's not entirely clear what you want to do, pass data from the button to the handler? Double curly brackets IMHO cannot be used in attributes. It is possible like this:

<input type="button" id="show-modal"
                 class="Insp"
                 :name="order.mod.real | safeseq"
                 @click="open(order.mod.real, oreder.mod.port, order.mod.id)
                 value="Открыть">

Next, in the handler, do what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question