XBoot Vue學習筆記

XBoot Vue學習筆記

  1. post請求
                this.postRequest('/stageTemplate/getFrontStages',{project_id:v}).then(res =>{
                    if(res.success ===  true){
                        this.$Message.success('獲取前置階段成果')
                    }
                })

  1. 頁面跳轉(zhuǎn)
    // 記錄返回路由
      let query = { id: v.id, backRoute: this.$route.name };
      this.$router.push({
        // 該路由已在/router/router.js中定義好 攜帶id參數(shù)
        name: "edit",
        query: query
      });



     init() {
          this.handleReset();
          this.form.id = this.$route.query.id;
          this.backRoute = this.$route.query.backRoute;
          this.getData();
        },

    // 關閉當前頁面
    closeCurrentPage() {
      this.$store.commit("removeTag", "edit");
      localStorage.pageOpenedList = JSON.stringify(
        this.$store.state.app.pageOpenedList
      );
      this.$router.push({
        name: this.backRoute
      });
    }


    watch: {
        // 監(jiān)聽路由變化通過id獲取數(shù)據(jù)
        $route(to, from) {
          if (to.name === "edit") {
            this.handleReset();
            this.form.id = this.$route.query.id;
            this.getData();
          }
        }
      },
      mounted() {
        this.init();
      }

3.獲取字典類型數(shù)據(jù)

      // 獲取請假類型字典數(shù)據(jù)
      getDictDataByType("leave_type").then(res => {
        if (res.success) {
          this.dictType = res.result;
        }
      });
      ```
4.

{
title: "建筑類型",
key: "architectureType",
minWidth: 120,
sortable: false,
align: "center",
render: (h, params) => {
let re = "";
this.allHouseTypes.forEach(e => {
if (e.id == params.row.architectureType) {
re = e.title;
}
});
return h("div", re);
}
},

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容