cari

Rumah  >  Soal Jawab  >  teks badan

javascript - prop dalam format json dalam vue force toString untuk dipanggil "[objek Objek]"

<template>
  <AboutConfirm :projects="projects"/>
</template>

<script>
  import AboutConfirm from '../../components/HomePage/AboutConfirm.vue'
  export default{
    data(){
      return {
        projects:[],
        projectsStr:''
      }
    },
    components: {
      AboutConfirm
    },
    created: function () {
      this.projects = this.$route.query
      this.projectsStr = JSON.stringify(this.$route.query)
    },
    beforeMount(){
      console.log('beforeMount');
      console.log('this.projects--------------');
      console.log(this.projects);
//      console.log(JSON.this.projectsStr);
      let url = SERVER.api.getMyProject
      PM.fnRequestAjax(url, null, 'get', (data) => {
//        this.projects = data.data.not_process
//        console.log('data.data.not_process');
//        console.log(data.data.not_process);
      })
    },
    mounted(){

    },
    updated(){
      console.log('updated');
    },
    activated(){
      console.log('activated');
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

Apabila melompat ke halaman lain dan memanggil window.history.go(-1), data yang dibaca sebelumMount menjadi "[objek Objek]"

巴扎黑巴扎黑2840 hari yang lalu686

membalas semua(2)saya akan balas

  • 漂亮男人

    漂亮男人2017-05-19 10:26:32

    [objek objek] ialah nilai pulangan lalai bagi kaedah object toString()
    Anda harus menggunakan JSON.stringify(obj) ;

    balas
    0
  • 漂亮男人

    漂亮男人2017-05-19 10:26:32

    Tiada siapa tahu projek apa yang telah dilalui

    balas
    0
  • Batalbalas