首页 > 解决方案 > Vue.js,将一个项目渲染到另一个项目中

问题描述

我有两个项目,localhost:8080 和 localhost:8081

我需要在第一个项目中渲染第二页,并使用类似这样的东西

routes.js中

{
   name:'someThing',
   path: 'someThing',
   component: something,
   props: { source: 'localhost:8081' }
}

东西.vue

<template>
    <iframe
        :src="source"
        :style="{ width: '100%', height: '99%', border: 0, overflow: hidden,  margin:0, padding: 0 }"
    >
    </iframe>
</template>

<script>
export default {
    name: 'something',
    props: {
        source: {
            type: String,
            required: true
        }
    }
}
</script>

正常吗?或者我应该使用插槽可能是

标签: vue.jsiframe

解决方案


推荐阅读