vue2.0 局部组件注册

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册局部组件</title>
    <script type="text/javascript" src="vue.js"></script>
</head>
<body>
    <div id="app">
        <aa-aa></aa-aa>
    </div>
    <script type="text/javascript">
    //局部组件注册 var ComponentA = { template : '<div>this a component</div>', } var vm = new Vue({ el: '#app', components: { 'aa-aa':ComponentA }, }); </script> </body> </html>

 

posted @ 2022-11-14 14:04  想你。  阅读(194)  评论(0)    收藏  举报