function getUrl(method, params) {
if (!method) throw new Error ('отсутствует метод!');
params = params || {};
params['access_token'] = ' ****************************** ';
return 'https://api.vk.com/method/' + method + '?&v=4.104&' + $.param(params);
}
$.ajax({
url: getUrl('wall.get', {owner_id: -********, count: 100, offset: 2, filter: 'owner', fields:'text, src_xbig, date'}),
method: 'GET',
dataType:'JSONP',
success: function(data) {
drawNews(data.response);
console.log(data);
}
});
function drawNews(news){
var html = ('');
for(var i = 1; i < news.length; i++){
var n = news[i++];
html += '<div><div style="width:300px; height:auto;"><p>'+ n.text +'</p><p>'+ n.date+'</p></div><img src="' + n.src_xbig + '"></div>';
}
$('#news').html(html);
}
<router-link to="/news" onClick="window.location.reload()">news</router-link>
<template>
<div id="app">
<img src="./assets/logo.png">
<div>
<router-link to="/">Home</router-link>
<router-link to="/news">News</router-link>
<router-link to="/about">About</router-link>
</div>
<keep-alive>
<router-view/>
</keep-alive>
</div>
</template>
<keep-alive>
<div id="vk_widget-news" class="vk_widget"></div>
</keep-alive>