The child element attributes in the component template of vue.js are parsed to the root element QAQ

I made a Vue.js component:

//nav.js
Vue.component("nav-ul-li", {
    props:["url"],
    template: "<li>    <a :href="url"><slot></slot></a>    </li>"
})

wrote a document:

<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test Document</title>
<script src="/js/vue.js"></script>
<script src="/js/nav.js"></script>
</head>
<body>
    <div id="frame">
        <nav id="top">
            <ul class="nav_top">
            <!--AAA-->
                <nav-ul-li v-for="data in datas"  :href="data.src">{{data.title}}</nav-ul-li>
            </ul>
        </nav>
    </div>
    <script>
    var Crowdfunding = new Vue({
        el: "-sharpframe",
        data: {
            datas: [
                { title: "Test Data" , src: "-sharp"},
                { title: "Test Data" , src: "-sharp"},
                { title: "Test Data" , src: "-sharp"},
                { title: "Test Data" , src: "-sharp" }
            ]
        }
    })
    </script>
</body>
</html>

as a result, < nav-ul-li vsway for = "data in datas": href= "data.src" > {{data.title}} < / nav-ul-li > is parsed into TAT:

<li href="-sharp"><a>Test Data</a></li>

Why did the href attribute I left for the a tag be robbed of TAT? by the li tag


li means that it doesn't carry the pot, because the prop you pass to the nav-ul-li component is href, and the props defined inside the component is url.

just change it this way:

<nav-ul-li v-for="data in datas"  :url="data.src">{{data.title}}</nav-ul-li>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7d0b-4f357.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7d0b-4f357.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?