<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
</head>
<div id="app">
<parenttag msg1="11" msg2="222"></parenttag>
</div>
<template id="mytmp">
<div>
<h1>{{msg1}}</h1>
<h2>{{msg2}}</h2>
</div>
</template>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<script type="text/javascript">
//父组件向子组件传信息 2层传信息
Vue.component("parenttag",{
template:"#mytmp",
props:["msg1","msg2"]
})
var app=new Vue({
el:"#app",
});
</script>
</body>
</html>
Vue多层组件传值 2层
最新推荐文章于 2024-02-23 15:26:48 发布