vue slot 2 slot memo

Vant component library with time, such as van-field interpolation value in time if you want to assembly, can use v-slot

Realized the left side of the input box to place a small icon in effect

<of- field
            v -model = "Phone" 
            placeholder = "Please enter the phone number" 
            v the -show = "isNew"
          >
            <template v-slot:left-icon>
              <div class="userAccount"></div>
            </template>
          </ On-field>

v-slot is vue2.6 new entrants named Slot slot = "left-icon"

Take this knowledge at slot slot review

 slot can pass the call to a sub-component tag value by value sub-assembly will be in the parent assembly

Such as

Parent component DoctorRegister.vue

<text-info @agreeHandle="agreeHandle">
        <template v-slot:header>222</template>
        <template slot-scope="slotProp">
          <div>
           {{slotProp.user.name}}
          </div>
        </template>
      </text-info>

 Subassemblies TextInfo.vue

<slot :user="user">{{user.name}}</slot>
<slot name="header"></slot>

Subassembly can be passed to a user of the parent component attribute

 

Guess you like

Origin www.cnblogs.com/junwu/p/11728780.html