+ 如果本地没有文本信息,就用网络请求

This commit is contained in:
maxmon 2021-06-09 01:00:39 +08:00
parent ee087fee55
commit b4183d74be
1 changed files with 15 additions and 11 deletions

View File

@ -284,18 +284,22 @@ export default {
const hasCache = !!that.nersCache[newFile]
that.$set(that, 'ners', that.nersCache[newFile] ? [...that.nersCache[newFile]] : [])
that.flushWordsType()
get(`/v1/anno/query?projectName=${that.projectName}&fileName=${newFile}`, function (info) {
if (that.nowText) {
delete window.isLoadingNowText
// 线
if (!hasCache && info.annoDetails) {
that.$set(that, 'ners', JSON.parse(info.annoDetails))
that.$set(that.nersCache, that.nowFile, [...that.ners])
that.flushWordsType()
}
//
that.$set(that.textDic, newFile, info.fileContent)
that.nowText = that.textDic[newFile]
})
} else {
get(`/v1/anno/query?projectName=${that.projectName}&fileName=${newFile}`, function (info) {
delete window.isLoadingNowText
// 线
if (!hasCache && info.annoDetails) {
that.$set(that, 'ners', JSON.parse(info.annoDetails))
that.$set(that.nersCache, that.nowFile, [...that.ners])
that.flushWordsType()
}
//
that.$set(that.textDic, newFile, info.fileContent)
that.nowText = that.textDic[newFile]
})
}
},
changeIdx: function (d) {
const nowIdx = this.files.indexOf(this.nowFile)