From 0b6ccc16a4fdcdb2dd8273a924bed625a32e8255 Mon Sep 17 00:00:00 2001 From: dntzhang Date: Mon, 1 Apr 2019 17:50:42 +0800 Subject: [PATCH] omi-cloud - sort the list by order field --- packages/omi-cloud/src/pages/list/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/omi-cloud/src/pages/list/index.js b/packages/omi-cloud/src/pages/list/index.js index a68fd3212..c76617494 100644 --- a/packages/omi-cloud/src/pages/list/index.js +++ b/packages/omi-cloud/src/pages/list/index.js @@ -28,8 +28,14 @@ define('page-about', class extends WeElement { success: res => { console.log('[云函数] [login] user openid: ', res.result.openid) app.globalData.openid = res.result.openid - app.globalData.db.collection('article').get().then(res => { - this.data.list = res.data + app.globalData.db.collection('article').field({ + title: true, + _id: true, + order: true + }).get().then(res => { + this.data.list = res.data.sort(function (a, b) { + return a.order - b.order + }) this.update() wx.hideLoading() })