Vue Custom form input component problem

clipboard.png
1. There is a value that references the parent component (props: ["value"]) when defining the child component, but why not pass in the value from the parent component when referencing?
2. Refer to whether the value of the bidirectional binding price of the subcomponent has been given to the value defined by the subcomponent, so there is no need to bind the value to the subcomponent.
3. Whether the price value of bidirectional binding is given to sapn or input, what is the function of bidirectional binding price

Mar.01,2021

  1. value is a special prop, that is a fixed usage. It is used to write custom form type components. When used with v-model, you can check the document.
  2. Yes, you can look up the document
  3. is given to the child component and does not belong to any dom. According to the structure of your code, it looks like this

    • data entry:

      • parent = > Child
      • child = > input (input can also be understood as a component)
    • data output:

      • input = = Custom event = > Child
      • Child = = Custom event = > parent

post ide/components.html-sharp%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BA%8B%E4%BB%B6%E7%9A%84%E8%A1%A8%E5%8D%95%E8%BE%93%E5%85%A5%E7%BB%84%E4%BB%B6" rel=" nofollow noreferrer "> document address


1) v-model is a binding such as input, which is not suitable for components
2) the value of the incoming component is one-way, not two-way
3) the input value received by the component is defined in pros. Please refer to the official document of vue


.

Xiao Ming: 1. You haven't figured out what parent-child components are. If you want to get data from app, you should write:

       :
       ...
       <currency-input :value="price"></currency-input>   
       ...
       :
       ...
       <input v-model="price" :value="value" @input="..."/>
       ...
     2.v-modelinput
Menu