首页 > 解决方案 > ExtJS中模型中URL中间的ID

问题描述

是否可以有一个像domain/users/{ID}/postsExtJS 模型一样的 URL?

此 URL 将获取给定用户 ID 的用户的所有帖子。

Ext.define('UserPosts', {
    extend: 'Ext.data.Model',

    fields: [{
        name: 'title',
        type: 'string'
    }, {
        name: 'body',
        type: 'string'
    }],
    proxy: {
        type: 'rest',
        noCache: false,
        pageParam: '',
        startParam: '',
        limitParam: '',
        groupParam: '',
        url: `domain/users/{ID}/posts`,
        reader: {
            type: 'json'
        }
    }
});

标签: javascriptapirestextjsmodel

解决方案


推荐阅读