Answer the question
In order to leave comments, you need to log in
VK API appWidgets.update how to send code correctly?
I want to send for example
{
"title": "My Table",
"title_url": "https://link",
"title_counter": 31,
"more": "Посмотреть все результаты",
"more_url": "https://link2",
"head": [{
"text": "Название первой колонки"
}, {
"text": "Название второй колонки",
"align": "center"
}],
"body": [
[{
"text": "Это первая ячейка первой строки",
"icon_id": "3484735_23434324"
},
{
"text": "Это вторая ячейка первой строки",
"url": "https://vk.com/wall-12345_542321"
}],
[{
"text": "Это первая ячейка второй строки",
"icon_id": "3484735_23434324"
},
{
"text": "Это вторая ячейка второй строки",
"url": "https://vk.com/wall-12345_54321"
}
]
]
}
vk.api.appWidgets.update({
type: `Table`,
code: //code
})
Answer the question
In order to leave comments, you need to log in
https://vk.com/dev/apps_widgets
code must return a JSON object describing the widget. Widget elements can contain only internal links to vk.com (except away.php) and vk.me.
In general, the code parameter looks like this:
return { widget };
const widget = {
"title": "My Table",
"title_url": "https://link",
"title_counter": 31,
// ...
};
vk.api.appWidgets.update({
type: `Table`,
code: 'return ' + JSON.stringify(widget) + ';'
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question