0

I'm new to Vuejs. How do we append more than one fields in v-text.

I wanted to displat result.stu_fname with result.stu_lname

tried with v-text="result.stu_lname"."". v-text="result.stu_fname" didn't work

<div id="app">
    <input type="text" v-model ="search_uin" placeholder="Type and wait!">
    <ul v-if="results.length > 0">
        <li v-for="result in results"  v-text="result.stu_lname"></li>
    </ul>
</div>

1 Answer 1

2

There several ways to do it.

  1. Use simple string concatenation inside v-text

     <li v-for="result in results"  v-text="result.stu_lname+' ' + result.stu_fname"></li>
    
  2. Without v-text

    {{result.stu_lname}} {{result.stu_fname}}

You can also created a method where u will pass result and return what u want. Also dont forget to add key for v-for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.