947047e5 by 田浩浩

添加新闻页读取

1 parent fb3d5c65
......@@ -18,5 +18,38 @@ $(function () {
, theme: '#0091FF'
});
})
addTabs('#news')
})
\ No newline at end of file
LoadNewsData();
layui.use('laytpl', function () {
laytpl = layui.laytpl;
var getTpl = document.getElementById('demo').innerHTML
, view = document.getElementById('ulNews');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
});
addTabs('#news');
//
});
//加载新闻列表数据
function LoadNewsData() {
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/hlwj/Mh/getNewsHotArticleList",//路径
dataType: "json",
async: false,
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
data.list = result.data;
}
}
});
}
var data = { //数据
"title": "Layui常用模块",
"list": []
};
\ No newline at end of file
......