<!-- 相对路径/绝对路径 --> <iframe src="../../../static/zsw.html"></iframe> <!-- 网址 --> <iframe src="https://cn.vuejs.org/v2/api/#v-html"></iframe>
<template> <div class="mod-config"> <span v-html="html"></span> </div> </template> <script> export default { data () { return { html: ‘‘, } },
} </script>
还会出现跨域的情况
推荐:https://www.php.cn/js-tutorial-386304.html
如果是直接引入html文件,v-html只加载html文件中的行内元素和内嵌样式,不加载外部样式(因此也可能不会加载外部的js脚本)。iframe可以加载外部的资源。
在Vue-cli 2.0 构建的项目中使用 iframe 引用本地静态 html 文件,放在 static文件夹下。
在Vue-cli 3.0 构建的项目中使用 iframe 引用本地静态 html 文件,放在 public 文件夹下。
推荐:https://blog.csdn.net/rudy_zhou/article/details/106003587
原文:https://www.cnblogs.com/wwct/p/14588749.html