How to use properties of a Component in vue.js when input text changed?React to property changes in JSON object using recursive components in Vue.jsVue.js pass data from slot into component instanceVue.js where to store non-component data properties?Vue.Js Multiple inputs with different typesAccessing and filtering child components defined in a Vue.js component's <slot>Vue.js 2 Multiple Properties defined in one Single-File componentvue.js - dynamically generated component in v-for does not update bound property correctlyUse @input or @change on input with value of computed propertyVue child component property does not workProps don't update when input changes in component

Do creatures with a listed speed of "0 ft., fly 30 ft. (hover)" ever touch the ground?

Forgetting the musical notes while performing in concert

Ambiguity in the definition of entropy

What are the G forces leaving Earth orbit?

Does Dispel Magic work on Tiny Hut?

What is the most common color to indicate the input-field is disabled?

Was the old ablative pronoun "med" or "mēd"?

Was the Stack Exchange "Happy April Fools" page fitting with the '90's code?

Theorists sure want true answers to this!

What is the opposite of "eschatology"?

How to travel to Japan while expressing milk?

Can someone clarify Hamming's notion of important problems in relation to modern academia?

In the UK, is it possible to get a referendum by a court decision?

Is there a hemisphere-neutral way of specifying a season?

One verb to replace 'be a member of' a club

my venezuela girlfriend wants to travel the USA where i live.what does she need to do and how expensive will it become or how difficult?

Mathematica command that allows it to read my intentions

Fair gambler's ruin problem intuition

What's the meaning of "Sollensaussagen"?

Why were 5.25" floppy drives cheaper than 8"?

How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction

Does the Idaho Potato Commission associate potato skins with healthy eating?

Why do I get negative height?

Different meanings of こわい



How to use properties of a Component in vue.js when input text changed?


React to property changes in JSON object using recursive components in Vue.jsVue.js pass data from slot into component instanceVue.js where to store non-component data properties?Vue.Js Multiple inputs with different typesAccessing and filtering child components defined in a Vue.js component's <slot>Vue.js 2 Multiple Properties defined in one Single-File componentvue.js - dynamically generated component in v-for does not update bound property correctlyUse @input or @change on input with value of computed propertyVue child component property does not workProps don't update when input changes in component













0















I'm using Vuesax Framework Components which it's working fine, but my in learning process for both laravel/vue.js and got a problem about how to use properties of component when input text got changed?



Consider this :



<vs-input
style="width:100%"
label="Label"
danger-text="character"
v-model="form.invoice_title"
name="invoice_title"/>


in top code component gonna show me a input text with a red color with text which will tell use what is wrong, but in right idea i should make that red color show when something is wrong with inputs, like `input must be more than 3 Characters'.
Input Component in vuesax



So here's what i wanna do make my input activate/trigger :danger & danger-text properties when something is wrong Like:



inputs must be more than 6 and less than 80 characters.










share|improve this question


























    0















    I'm using Vuesax Framework Components which it's working fine, but my in learning process for both laravel/vue.js and got a problem about how to use properties of component when input text got changed?



    Consider this :



    <vs-input
    style="width:100%"
    label="Label"
    danger-text="character"
    v-model="form.invoice_title"
    name="invoice_title"/>


    in top code component gonna show me a input text with a red color with text which will tell use what is wrong, but in right idea i should make that red color show when something is wrong with inputs, like `input must be more than 3 Characters'.
    Input Component in vuesax



    So here's what i wanna do make my input activate/trigger :danger & danger-text properties when something is wrong Like:



    inputs must be more than 6 and less than 80 characters.










    share|improve this question
























      0












      0








      0








      I'm using Vuesax Framework Components which it's working fine, but my in learning process for both laravel/vue.js and got a problem about how to use properties of component when input text got changed?



      Consider this :



      <vs-input
      style="width:100%"
      label="Label"
      danger-text="character"
      v-model="form.invoice_title"
      name="invoice_title"/>


      in top code component gonna show me a input text with a red color with text which will tell use what is wrong, but in right idea i should make that red color show when something is wrong with inputs, like `input must be more than 3 Characters'.
      Input Component in vuesax



      So here's what i wanna do make my input activate/trigger :danger & danger-text properties when something is wrong Like:



      inputs must be more than 6 and less than 80 characters.










      share|improve this question














      I'm using Vuesax Framework Components which it's working fine, but my in learning process for both laravel/vue.js and got a problem about how to use properties of component when input text got changed?



      Consider this :



      <vs-input
      style="width:100%"
      label="Label"
      danger-text="character"
      v-model="form.invoice_title"
      name="invoice_title"/>


      in top code component gonna show me a input text with a red color with text which will tell use what is wrong, but in right idea i should make that red color show when something is wrong with inputs, like `input must be more than 3 Characters'.
      Input Component in vuesax



      So here's what i wanna do make my input activate/trigger :danger & danger-text properties when something is wrong Like:



      inputs must be more than 6 and less than 80 characters.







      vue.js vuejs2 vue-component






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 21:11









      Mohammad EskandariMohammad Eskandari

      4710




      4710






















          1 Answer
          1






          active

          oldest

          votes


















          1














          This can be done via a computed property. eg:



          <vs-input
          style="width:100%"
          label="Label"
          :danger="hasError"
          :danger-text="errorText"
          v-model="form.invoice_title"
          name="invoice_title"/>

          ... // in javascript

          computed()
          hasError()
          return this.form.invoice_title.length < 6
          errorText()
          if (this.form.invoice_title.length < 6)
          return 'Invoice title should be at least 6 characters'

          if (this.form.invoice_title.length > 80)
          return 'Invoice title should be at most 80 characters'

          return ''




          I highly recommend vuelidate lib form managing validation






          share|improve this answer























          • hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

            – Mohammad Eskandari
            Mar 9 at 17:29






          • 1





            note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

            – Andy
            Mar 12 at 21:27











          • oh. i've got it done. thanks mate.

            – Mohammad Eskandari
            Mar 15 at 3:35











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071048%2fhow-to-use-properties-of-a-component-in-vue-js-when-input-text-changed%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          This can be done via a computed property. eg:



          <vs-input
          style="width:100%"
          label="Label"
          :danger="hasError"
          :danger-text="errorText"
          v-model="form.invoice_title"
          name="invoice_title"/>

          ... // in javascript

          computed()
          hasError()
          return this.form.invoice_title.length < 6
          errorText()
          if (this.form.invoice_title.length < 6)
          return 'Invoice title should be at least 6 characters'

          if (this.form.invoice_title.length > 80)
          return 'Invoice title should be at most 80 characters'

          return ''




          I highly recommend vuelidate lib form managing validation






          share|improve this answer























          • hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

            – Mohammad Eskandari
            Mar 9 at 17:29






          • 1





            note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

            – Andy
            Mar 12 at 21:27











          • oh. i've got it done. thanks mate.

            – Mohammad Eskandari
            Mar 15 at 3:35















          1














          This can be done via a computed property. eg:



          <vs-input
          style="width:100%"
          label="Label"
          :danger="hasError"
          :danger-text="errorText"
          v-model="form.invoice_title"
          name="invoice_title"/>

          ... // in javascript

          computed()
          hasError()
          return this.form.invoice_title.length < 6
          errorText()
          if (this.form.invoice_title.length < 6)
          return 'Invoice title should be at least 6 characters'

          if (this.form.invoice_title.length > 80)
          return 'Invoice title should be at most 80 characters'

          return ''




          I highly recommend vuelidate lib form managing validation






          share|improve this answer























          • hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

            – Mohammad Eskandari
            Mar 9 at 17:29






          • 1





            note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

            – Andy
            Mar 12 at 21:27











          • oh. i've got it done. thanks mate.

            – Mohammad Eskandari
            Mar 15 at 3:35













          1












          1








          1







          This can be done via a computed property. eg:



          <vs-input
          style="width:100%"
          label="Label"
          :danger="hasError"
          :danger-text="errorText"
          v-model="form.invoice_title"
          name="invoice_title"/>

          ... // in javascript

          computed()
          hasError()
          return this.form.invoice_title.length < 6
          errorText()
          if (this.form.invoice_title.length < 6)
          return 'Invoice title should be at least 6 characters'

          if (this.form.invoice_title.length > 80)
          return 'Invoice title should be at most 80 characters'

          return ''




          I highly recommend vuelidate lib form managing validation






          share|improve this answer













          This can be done via a computed property. eg:



          <vs-input
          style="width:100%"
          label="Label"
          :danger="hasError"
          :danger-text="errorText"
          v-model="form.invoice_title"
          name="invoice_title"/>

          ... // in javascript

          computed()
          hasError()
          return this.form.invoice_title.length < 6
          errorText()
          if (this.form.invoice_title.length < 6)
          return 'Invoice title should be at least 6 characters'

          if (this.form.invoice_title.length > 80)
          return 'Invoice title should be at most 80 characters'

          return ''




          I highly recommend vuelidate lib form managing validation







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 7:07









          AndyAndy

          5,38022019




          5,38022019












          • hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

            – Mohammad Eskandari
            Mar 9 at 17:29






          • 1





            note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

            – Andy
            Mar 12 at 21:27











          • oh. i've got it done. thanks mate.

            – Mohammad Eskandari
            Mar 15 at 3:35

















          • hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

            – Mohammad Eskandari
            Mar 9 at 17:29






          • 1





            note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

            – Andy
            Mar 12 at 21:27











          • oh. i've got it done. thanks mate.

            – Mohammad Eskandari
            Mar 15 at 3:35
















          hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

          – Mohammad Eskandari
          Mar 9 at 17:29





          hasError work but errorText won't work. computed method when inputs go wrong it just say errorText

          – Mohammad Eskandari
          Mar 9 at 17:29




          1




          1





          note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

          – Andy
          Mar 12 at 21:27





          note that I used a colon (:) that designates it's a bound property, alias to v-bind:danger-text. If you don't it will just use the variable you give it as text.

          – Andy
          Mar 12 at 21:27













          oh. i've got it done. thanks mate.

          – Mohammad Eskandari
          Mar 15 at 3:35





          oh. i've got it done. thanks mate.

          – Mohammad Eskandari
          Mar 15 at 3:35



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071048%2fhow-to-use-properties-of-a-component-in-vue-js-when-input-text-changed%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Can't find variable: document ReactNative Js2019 Community Moderator ElectionReactNative: how to center text?Can't find variable: navigate - ReactNative navigationReact Native error: “Can't find variable: TouchableHighlight”How to use Expo.DocumentPicker.getDocumentAsync properly. [Expo] [ReactNative]Can't find variable: regeneratorRuntime (ReactNative)Reactnative Expo It is advisable for a StartUp?Can't find variable : Self / Can't install firebaseNPM Install Error in installing ReactNative CLIContacts Displaying in App using ReactnativeFacebook login error: can't find variable: Alert

          Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices