1"use strict";(globalThis.webpackChunknocobase=globalThis.webpackChunknocobase||[]).push([["8138"],{26177(a,e,t){t.r(e),t.d(e,{default:()=>s});let s={contexts:[t(79271).JSBlockRunJSContext],prefix:"sn-jsb-fetch-list",label:"Fetch & render list",description:"Fetch a small list via ctx.api and render basic HTML",locales:{"zh-CN":{label:"æå并渲æå表",description:"ä½¿ç¨ ctx.api æåå°éæ°æ®ï¼å¹¶æ¸²æåºç¡ HTML å表"}},content:` 2// Fetch users 3const { data } = await ctx.request({ 4 url: 'users:list', 5 method: 'get', 6 params: { pageSize: 5 }, 7}); 8const rows = Array.isArray(data?.data) ? data.data : (Array.isArray(data) ? data : []); 9 10// Render as a simple HTML list 11ctx.render([ 12 '<div style="padding:12px">', 13 '<h4 style="margin:0 0 8px">' + ctx.t('Users') + '</h4>', 14 '<ul style="margin:0; padding-left:20px">', 15 ...rows.map((r, i) => '<li>#' + (i + 1) + ': ' + String((r && (r.nickname ?? r.username ?? r.id)) ?? '') + '</li>'), 16 '</ul>', 17 '</div>' 18].join('')); 19`}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.