Copertine: validazione contenuto prima del caching (niente più HTML in cache), id fisso per il dettaglio, handler con sintassi moderna
This commit is contained in:
@@ -172,13 +172,14 @@ Page {
|
||||
|
||||
Component.onCompleted: {
|
||||
if (bookData.coverUrl && bookData.coverUrl.length > 0)
|
||||
apiClient.fetchImage(bookData.coverUrl, "detail:" + bookData.id)
|
||||
apiClient.fetchImage(bookData.coverUrl, "detailcover")
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: apiClient
|
||||
onImageReady: {
|
||||
if (id === "detail:" + bookData.id)
|
||||
// nota: parametro rinominato (imageId) — "id" è parola chiave QML e rompe il confronto
|
||||
onImageReady: function(imageId, localPath) {
|
||||
if (imageId === "detailcover")
|
||||
page.coverSource = localPath
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,9 +175,9 @@ Page {
|
||||
page.loadingMore = false
|
||||
page.errorMessage = message
|
||||
}
|
||||
onImageReady: {
|
||||
onImageReady: function(imageId, localPath) {
|
||||
for (var i = 0; i < feedModel.count; i++) {
|
||||
if (feedModel.get(i).coverId === id) {
|
||||
if (feedModel.get(i).coverId === imageId) {
|
||||
feedModel.setProperty(i, "coverSource", localPath)
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user