apiChannel 欄目列表
apiChannel 欄目列表
獲取欄目列表數據。
快速開始(復制即用)
微信原生版
let that = this;
app.globalData._requestApi(
that,
app.globalData.config.apiIndexUrl,
{
apiChannel_1: `ekey=1&type=sonself¤tstyle=active&showalltext=on`
},
function(res) {
that.setData({
channel_1: res.data.apiChannel[1].data
});
}
);<view wx:for="{{channel_1}}" wx:key="id">
<text>{{item.typename}}</text>
</view>uni-app 版
let that = this;
app.globalData._requestApi(
that,
app.globalData.config.apiIndexUrl,
{
apiChannel_1: `ekey=1&type=sonself¤tstyle=active&showalltext=on`
},
function(res) {
that.channel_1 = res.data.apiChannel[1].data;
}
);<view v-for="item in channel_1" :key="item.id">
<text>{{item.typename}}</text>
</view>?? ekey=1 必須對應 apiChannel[1],數字要一致!
全部參數
基礎參數
| 參數 | 說明 | 示例 |
|---|---|---|
ekey | 必填,唯一標識,數字必須與返回的 apiChannel[數字] 對應 | ekey=1 |
typeid | 欄目ID(0表示頂級欄目) | typeid=0 |
channelid | 模型ID 在文檔列表頁使用時可以此參數可以不用拼接url | channelid=1 |
limit | '起始ID,記錄數'(起始ID從0開始)表示限定的記錄范圍(如:limit='1,2' 表示從ID為1的記錄開始,取2條記錄) | limit=0,10 |
currentstyle | 應用樣式class類名 | currentstyle=active |
showalltext | on或者off,等于on時效果如下,返回一個全部,等于off則不返回'全部' | showalltext=on |
type 可選值:
son- 表示下級欄目self- 表示同級欄目top- 表示頂級欄目sonself- 表示當前下級欄目以及同級欄目first- 表示當前欄目ID的最頂級欄目下的第一級全部欄目
常用場景(直接復制)
頂級欄目列表:ekey=1&typeid=1&limit=0,10 指定模型欄目:ekey=1&channelid=1&limit=0,5 帶全部選項:ekey=1&typeid=0&showalltext=on
底層字段: 查閱易優數據字典,表名 ey_arctype
(注:在沒(mei)有(you)(you)指定typeid的情況下(xia),type標記與模板的環境有(you)(you)關,如:模板生成(cheng)到欄目(mu)一,那么type='son'就表示(shi)欄目(mu)一的所有(you)(you)子欄目(mu))
文檔最后更新時間:2026-01-08 16:32:57
未解決你的問題?請到「問答社區」反饋你遇到的問題

