Vue项目——引入外部组件


1.声明一个组件  chila.vue

<template> <div> child1 //显示内容 </div> </template> <script> export default { name: "child1" } </script>

  

1


2.引用 parent.vue



<template> <div> <child1 ref="child1"></child1> //使用 </div> </template> <script> import Child1 from './child1'; //引用 export default { name: "parent", components: {child1: Child1} } </script>

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM