Jump to content

If Statement Fun


ben03
 Share

Recommended Posts

I have a load of data coming from the database, of which I have not control of. When it comes in I am putting it in an html table.

I have set up a basic if statement: If it is a blank field, show 'NA'. If not, show the figures in an input that a user can edit.

The trouble I am running into is if a user backspaces the characters in the input, it then of course beomes the static text 'NA', but I need it to remain an input!

What can I do in this scenario to prevent this from happening? I am using Vue.js, below is what I am using: 

                        <div v-if="item.value === ''">
                            NA
                        </div>
                        <div v-else>
                            <input class="input is-small" v-model="item.value">
                        </div>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...