chore: try use quasar bus
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-11-14 14:54:06 +01:00
parent 68994db6ff
commit 65e2f950b9
3 changed files with 24 additions and 1 deletions

7
src/boot/removeBus.js Normal file
View File

@ -0,0 +1,7 @@
import { EventBus } from 'quasar';
import { boot } from 'quasar/wrappers';
export default boot(({ app }) => {
const bus = new EventBus();
app.provide('remove', bus);
});

View File

@ -4,6 +4,9 @@ import { useI18n } from 'vue-i18n';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
const $attrs = useAttrs(); const $attrs = useAttrs();
import { inject } from 'vue';
const bus = inject('bus'); // inside setup()
const { isRequired, requiredFieldRule } = useRequired($attrs); const { isRequired, requiredFieldRule } = useRequired($attrs);
const { t } = useI18n(); const { t } = useI18n();
const emit = defineEmits([ const emit = defineEmits([
@ -107,6 +110,8 @@ const mixinRules = [
value = null; value = null;
vnInputRef.focus(); vnInputRef.focus();
emit('remove'); emit('remove');
console.log('HOLA');
bus.emit('some-event', 'hola');
} }
" "
></QIcon> ></QIcon>

View File

@ -5,7 +5,13 @@ import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import toDate from 'filters/toDate'; import toDate from 'filters/toDate';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import { inject } from 'vue';
const bus = inject('bus'); // inside setup()
console.log('bus: ', bus);
bus.on('some-event', (arg1, arg2, arg3) => {
console.log('REMOVED');
});
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
@ -294,7 +300,12 @@ defineExpose({ search, sanitizer, userParams });
<QSeparator /> <QSeparator />
</QList> </QList>
<QList dense class="list q-gutter-y-sm q-mt-sm"> <QList dense class="list q-gutter-y-sm q-mt-sm">
<slot name="body" :params="sanitizer(userParams)" :search-fn="search"></slot> <slot
name="body"
:params="sanitizer(userParams)"
:search-fn="search"
@remove="(key) => console.log('ASD')"
></slot>
</QList> </QList>
</QForm> </QForm>
<QInnerLoading <QInnerLoading