Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
73 views
in Technique[技术] by (71.8m points)

javascript - Display array value in vuejs

I want to display the name value of an array but it is returning null

async getInscription() {
      const response = await api.post('graphql', {
        query: `
          query{
            getInscription(id: ${this.id}){
              id
              inscriptionStatus {
                status
              }
              inscriptionProfile {
                profile
              }
              education_level
              name
              cpf
              phone
              date_birth
              sex
              state
              city
              rg
              company_name
              office
              email
              email_verified_at
              password
              created_at
              updated_at
            }
          }
        `,
      });

const { getInscription } = response.data.data;
var cityObj = getInscription.city;

Reponse:

{"data":{"getInscription":{"city":"{"id":5577,"state_id":7,"name":"New York"}",}}}

How can I do to return only the name?

Since when I place cityObj.name or cityObj ['name'] the value is null.

question from:https://stackoverflow.com/questions/66050517/display-array-value-in-vuejs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...