修复前端异步请求问题

This commit is contained in:
橙子
2021-10-24 18:16:26 +08:00
parent dd4a8aad51
commit 7d324db5ae
4 changed files with 118 additions and 120 deletions

View File

@@ -183,7 +183,7 @@ namespace Yi.Framework.Model.DbInit
menu_name="add",is_show=0,
mould=new mould()
{
mould_name="del",url="/Mould/addMould"
mould_name="add",url="/Mould/addMould"
}
}
}

View File

@@ -24,7 +24,7 @@
></v-text-field>
<v-btn
v-if="axiosUrls.add!=''"
v-if="axiosUrls.add != null"
color="primary"
dark
class="mb-2 mx-2"
@@ -35,7 +35,7 @@
<!-- 添加提示框 -->
<v-dialog
v-if="axiosUrls.add!=''"
v-if="axiosUrls.add != null"
v-model="dialog"
max-width="500px"
>
@@ -72,9 +72,8 @@
</v-dialog>
<v-btn
v-if="axiosUrls.del!=''"
v-if="axiosUrls.del != null"
color="secondary"
class="mb-2"
@click="deleteItem(null)"
>
@@ -85,26 +84,19 @@
<!-- 表格中的删除和修改 -->
<template v-slot:item.actions="{ item }">
<slot name="action" :item="item"></slot>
<v-icon
v-if="axiosUrls.update!=''"
v-if="axiosUrls.update != null"
small
class="mr-2"
@click="editItem(item)"
>
mdi-pencil
</v-icon>
<v-icon
v-if="axiosUrls.del!=''"
small
@click="deleteItem(item)"
>
<v-icon v-if="axiosUrls.del != null" small @click="deleteItem(item)">
mdi-delete
</v-icon>
</template>
<!-- 初始化 -->
@@ -116,7 +108,6 @@
<script>
import itemApi from "./TableApi.js";
export default {
name: "ccTable",
props: {
defaultItem: {
@@ -146,15 +137,21 @@ export default {
},
watch: {
axiosUrls: {
handler(val, oldVal) {
this.dataInit(val.get);
},
deep: true,
},
selected: {
handler(val, oldVal) {
this.$emit("selected", val);
},
deep:true
deep: true,
},
dialog(val) {
val || this.close();
}
},
},
created() {
@@ -162,12 +159,17 @@ export default {
},
methods: {
initialize() {
itemApi.getItem(this.axiosUrls.get).then((resp) => {
dataInit(getStr) {
itemApi.getItem(getStr).then((resp) => {
const response = resp.data;
this.desserts = response;
});
},
initialize() {
if(this.axiosUrls.get!=undefined && this.axiosUrls.get!=null )
{
this.dataInit(this.axiosUrls.get)
}
this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;

View File

@@ -58,7 +58,7 @@
<v-btn v-if="item.mould" class="mr-2">接口地址:{{ item.mould.url }}</v-btn>
<ccCombobox
headers="设置接口权限"
itemText="mould_name"
itemText="url"
:items="mouldList"
@select="getSelect"
>

View File

@@ -28,10 +28,6 @@ export default {
data: () => ({
start: true,
axiosUrls: {
// get: "role/getrole",
// update: "role/updaterole",
// del: "role/delListrole",
// add: "role/addrole",
},
headers: [
{ text: "编号", align: "start", value: "id" },