Skip to content

Commit

Permalink
fix(loading): v-loading's lifecycle name replace by inserted (#2759)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenjunjian authored Jan 8, 2025
1 parent d4228d9 commit 336f42f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/vue-common/src/adapter/vue2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ export const directive = (directives) => {
for (const name in directives) {
const content = directives[name]

mapping(content, 'mounted', 'inserted')
mapping(content, 'beforeMount', 'bind')
mapping(content, 'updated', 'update')
mapping(content, 'unmounted', 'unbind')
Expand Down
1 change: 1 addition & 0 deletions packages/vue-common/src/adapter/vue3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ export const directive = (directives) => {
for (const name in directives) {
const content = directives[name]

mapping(content, 'inserted', 'mounted')
mapping(content, 'bind', 'beforeMount')
mapping(content, 'update', 'updated')
mapping(content, 'unbind', 'unmounted')
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/src/loading/src/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const toggleLoading = (el, binding, maskInstance) => {
}

const vLoading = {
bind(el, binding, vnode) {
inserted(el, binding, vnode) {
const vm = vnode.context
const textExr = el.getAttribute(constants.TEXT_ATTR)
const spinnerExr = el.getAttribute(constants.TEXT_SPINNER)
Expand All @@ -132,7 +132,7 @@ const vLoading = {
component: Loading,
propsData: {
_constants: constants,
tiny_mode: vm.tiny_mode?.value || appProperties().tiny_mode?.value
tiny_mode: vm?.tiny_mode?.value || appProperties().tiny_mode?.value
},
el: document.createElement('div')
})
Expand Down

0 comments on commit 336f42f

Please sign in to comment.