在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue.js路由匹配問題

vue.js路由匹配問題

post傳參的時候categorys 為啥不能識別呢?
圖片描述
代碼貼在下面:

<script>
export default {
  name: "app",
  components: {},
  data() {
    return {
      banner: require("@/assets/hottopic/banner.png"),
      data: [],
      filter: {
        page: {
          pageSize: 5,
          pageNumber: 1,
          totalSize: 100
        },
        categorys: ["小微企業(yè)專題"]
      }
    };
  },
  computed: {},
  methods: {
    getData() {
      this.filter.categorys = ["this.$route.params.id"]
      this.$API.post("/articlelist/query", this.filter).then(res => {
        console.log(res);
        this.data = res.list;
      });
    }
  },
  created() {
    if(this.$route.params.id){
      this.getData();
    }
  },
  mounted() {},
  watch:{
    "$route":"getData"
  }
};
</script>
回答
編輯回答
悶騷型

傳入的數(shù)據(jù)帶雙引號,被認(rèn)為是字符串

2017年8月8日 19:27
編輯回答
扯機薄

把引號去掉:

this.filter.categorys = [this.$route.params.id];
2017年4月28日 12:44
編輯回答
涼汐
this.filter.categorys= [`${this.$route.params.id}`]
2017年1月14日 10:57