Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: add button loading status #4287

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/Apps/AssetSelect/dialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<Dialog
ref="customDialog"
:close-on-click-modal="false"
:title="$tc('assets.Assets')"
custom-class="asset-select-dialog"
Expand All @@ -21,6 +22,7 @@
:tree-setting="treeSetting"
class="tree-table"
v-bind="$attrs"
@loaded="handleTableLoaded"
/>
</Dialog>
</template>
Expand Down Expand Up @@ -143,6 +145,9 @@ export default {
if (selectValueIndex > -1) {
this.rowSelected.splice(selectValueIndex, 1)
}
},
handleTableLoaded() {
this.$refs.customDialog.loaded()
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Apps/AssetSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<script>
import Select2 from '@/components/Form/FormFields/Select2.vue'
import AssetSelectDialog from './dialog.vue'
import { b } from 'css-color-function/lib/adjusters'

export default {
componentName: 'AssetSelect',
Expand Down Expand Up @@ -81,7 +80,6 @@ export default {
}
},
methods: {
b,
handleFocus() {
this.$refs.select2.selectRef.blur()
this.dialogVisible = true
Expand Down
15 changes: 12 additions & 3 deletions src/components/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
v-bind="$attrs"
v-on="$listeners"
>
<slot />
<div v-loading="!isLoaded">
<slot />
</div>
<div slot="footer" class="dialog-footer">
<slot name="footer">
<el-button v-if="showCancel && showButtons" @click="onCancel">{{ cancelTitle }}</el-button>
<el-button v-if="showConfirm && showButtons" :loading="loadingStatus" type="primary" @click="onConfirm">
<el-button v-if="showConfirm && showButtons" :disabled="!isLoaded" type="primary" @click="onConfirm">
{{ confirmTitle }}
</el-button>
</slot>
Expand Down Expand Up @@ -71,14 +73,21 @@ export default {
}
},
data() {
return {}
return {
isLoaded: false
}
},
computed: {
iWidth() {
return this.$store.getters.isMobile ? '1000px' : this.width
}
},
mounted() {
},
methods: {
loaded() {
this.isLoaded = true
},
onCancel() {
this.$emit('cancel')
},
Expand Down
11 changes: 6 additions & 5 deletions src/components/Form/FormFields/TransferSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@
/>
<Dialog
v-if="showTransfer"
ref="customDialog"
:close-on-click-modal="false"
:title="label"
:visible.sync="showTransfer"
class="the-dialog"
width="730px"
@cancel="handleTransCancel"
@confirm="handleTransConfirm"
v-on="$listeners"
>
<krryPaging v-if="selectInitialized" ref="pageTransfer" class="transfer" v-bind="pagingTransfer" />
<krryPaging v-if="selectInitialized" ref="pageTransfer" class="transfer" v-bind="pagingTransfer" @loaded="handleLoaded" />
</Dialog>
</div>
</template>
Expand Down Expand Up @@ -162,11 +164,10 @@ export default {
this.select2.options = options
this.emit(options.map(item => item.value))
this.showTransfer = false
},
handleLoaded() {
this.$refs.customDialog.loaded()
}
}
}
</script>

<style scoped>

</style>
2 changes: 2 additions & 0 deletions src/components/Libs/Krry/paging/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ export default {
ele => !checkDataId.includes(ele.id)
)
}

this.$emit('loaded')
},
searchWord(keyword, titleId) {
// 过滤掉数据,保留搜索的数据
Expand Down
3 changes: 3 additions & 0 deletions src/components/Table/DataTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<script>
import { default as ElDatableTable } from './compenents/el-data-table'
import { mapGetters } from 'vuex'
import { eventBus } from '@/utils/const'

export default {
name: 'DataTable',
Expand Down Expand Up @@ -153,6 +154,8 @@ export default {
this.toggleRowSelection(row, true)
}
}

eventBus.$emit('loaded')
},
handleSizeChange(val) {
localStorage.setItem('paginationSize', val)
Expand Down
Loading