添加mock数据
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
|
||||
<script lang="uts">
|
||||
import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import { USE_MOCK, MOCK_MERCHANT_ID, getMockReviews } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
|
||||
|
||||
type ReviewType = {
|
||||
id: string
|
||||
@@ -100,6 +101,11 @@
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
if (USE_MOCK) {
|
||||
this.merchantId = MOCK_MERCHANT_ID
|
||||
this.loadReviews()
|
||||
return
|
||||
}
|
||||
// 同步设置 merchantId,不用 async 包裹,避免 generator 内 this 绑定异常
|
||||
try {
|
||||
const session = supa.getSession()
|
||||
@@ -117,6 +123,13 @@
|
||||
if (!this.merchantId || this.merchantId.split('-').length !== 5) return
|
||||
if (this.loading) return
|
||||
this.loading = true
|
||||
if (USE_MOCK) {
|
||||
this.reviews = getMockReviews(this.currentFilter) as ReviewType[]
|
||||
this.hasMore = false
|
||||
this.loading = false
|
||||
this.refreshing = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let query = supa
|
||||
.from('ml_product_reviews')
|
||||
|
||||
Reference in New Issue
Block a user