前端常用代码

提交json数据

this.$http.post("/api/getsenbyuserid",this.RequestByFirstPageDate,{
    headers: {
        'Content-Type':'application/json;charset=UTF-8'
    }

    }).then(response => {
        // 响应成功回调
    }),
    function(response) {
        // 响应错误回调
    };

从route取值

this.$route.params.classifyid

从store取值

取字符串

this.$store.state.token

取json 需要转换下

(JSON.parse(this.$store.state.user)).userId;

vue文件模板

<template>
  <div class="logreg">
    <h1>This is an about page</h1>
  </div>
</template>
<script>
export default {
  name: 'logreg',
  components: {
    
  },
  props: {
    va: String,
    ty: Number
  },
  data(){
    return {
      loading:false
    }
  },
  watch:{

  },
  created(){
    
  },
  methods:{

  },
  mounted(){
    
  }
}
</script>
<style scoped lang="less">

</style>
Last modification:December 9th, 2019 at 02:11 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment