Html 实现静态页面分离,和互相调用VUE元素方法

时间:2021-02-28 00:21:36   收藏:0   阅读:179

主要依靠一个js文件 ,引入到content页面

$(function () {
    $.get("header.html",function (data) {
        $("#header").html(data);
    });
    $.get("footer.html",function (data) {
        $("#footer").html(data);
    });
});

为三个页面分别创建html文件

header.html   footer.html

在content页面,使用标签引入

<!--引入头部-->
<div id="header"></div>


<!--body其他内容-->

<!--引入footer部-->
<div id="footer"></div>
<!--导入布局js,共享header和footer-->
<script type="text/javascript" src="js/include.js"></script>

 

互相调用vue元素

 例如:在content页面 vue 逻辑代码部分 使用 "非匿名"

var routeVue = new Vue({
  内容体
})

从header.html 中调用
routeVue._data.pageBean.minPrice=0;
routeVue._data.pageBean.maxPrice=0;
routeVue.findRouteByCat()

 

原文:https://www.cnblogs.com/buglife/p/14456909.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!