The problem of passing values of component attributes in Vue

<div id="app">
        {{message}}
        <customize prop="xxx"></customize>
    </div>
    <script type="text/javascript">
        //
    var customize = {
        //
        template: `

{{prop}}

`, // // props: ["prop"] } var app = new Vue({ el: "-sharpapp", data: { message: "{{message}}:hello customize components" }, components: { "customize": customize } }) </script>

as in the code above, the template will not render the content of {{prop}} because:

/ / props: ["prop"]

and still remain in DOM:
< p prop= "xxx" >

""

props: ["prop"]

DOM:

so what"s the practical point of this? In addition, what should I do if I want to pass a value to the property prop of the component?

Mar.21,2021

attribute binding with v-bind or : take a good look at the document, otherwise you will just pass a string as xxx .

Menu