Study Notes (17): Vue2.x from entry to the property to combat -Component component props

Learning immediately: https://edu.csdn.net/course/play/6823/135327?utm_source=blogtoedu

Properties props Component assembly

1, and acquires the attribute values ​​define the properties

<pop :here="country"></pop>
var app=new Vue({
        el:'#app',
        data:{
            china:'sichuan'
        },
        components:{
           " pop":{
                template:`<p style="color:blue;">panda from {{here}}</p>`,
                props:['here']
            }
        }
    })

Custom properties need to use props options, plus an array of property names, registered in the constructor inside local label, here Properties tab in the incoming template, then props to set the property value here, the value of the property here pass template components.

A novice, if inadequate, please correct me!

Published 15 original articles · won praise 0 · Views 108

Guess you like

Origin blog.csdn.net/weixin_45721211/article/details/104500441