javascript – Requisiten im JSON-Format in Vue erzwingen, dass toString „[object object]' heißt
巴扎黑
巴扎黑 2017-05-19 10:24:32
0
2
639
<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>

Wenn Sie zu anderen Seiten springen und window.history.go(-1) aufrufen, werden die vorMount eingelesenen Daten zu „[object Object]“

巴扎黑
巴扎黑

Antworte allen(2)
漂亮男人

[object object] 是 对象 toString() 方法的默认返回值
你应该用 JSON.stringify(obj) ;

漂亮男人

没有人知道projects经历了什么

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage