vue:从一个vue页面引入另一个vue页面的内容
1.编写被引入的页面:<template><div id="mychart" :style="{width: '500px', height: '500px'}">{{msg}}</div></template><script>export default {name: 'Footer',data () {return {msg: '【这
·
1.编写被引入的页面:
<template>
<div id="mychart" :style="{width: '500px', height: '500px'}">{{msg}}</div>
</template>
<script>
export default {
name: 'Footer',
data () {
return {
msg: '【这里是外部页面传入的消息】'
}
},
mounted(){
this.drawLine();
},
methods: {
}
}
</script>
2.在需要引入的页面import,
import Footer from "@/components/Footer"
from 后是被引入的页面的路径,"@"表示src目录.
3.在需要引入的页面加入被引入的页面
components: { Footer },
4.使用被引入的页面
<Footer></Footer>
更多推荐
所有评论(0)