我是 vue.js 的新手,我有一个简单的问题。
我有如下代码:
asyncData({ params, error }) {
return Job.api()
.fetchByID(params.id)
.then((response) => {
const selectedJob = response.entities.jobs[0]
if (selectedJob) {
const industryID = selectedJob.industryId
return Industry.api()
.fetchByID(industryID)
.then((result) => {
const jobInd = result.response.data
return {
tagsArray:
selectedJob.tags === 'null' || selectedJob.tags === ''
? []
: selectedJob.tags.split(','),
job: selectedJob,
jobIndustry: jobInd,
}
})
.catch(() => {
error({
statusCode: 404,
message: 'Job Industry not found',
})
})
}
})
.catch(() => {
error({
statusCode: 404,
message: 'Job not …Run Code Online (Sandbox Code Playgroud)