diff --git a/quasar.config.js b/quasar.config.js index 5932f48dc..5ce46667c 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -29,7 +29,7 @@ module.exports = configure(function (/* ctx */) { // app boot file (/src/boot) // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files - boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar'], + boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar.defaults'], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css css: ['app.scss'], diff --git a/src/boot/defaults/qTable.js b/src/boot/defaults/qTable.js new file mode 100644 index 000000000..8902d4266 --- /dev/null +++ b/src/boot/defaults/qTable.js @@ -0,0 +1,5 @@ +import { QTable } from 'quasar'; +import setDefault from './setDefault'; + +setDefault(QTable, 'pagination', { rowsPerPage: 0 }); +setDefault(QTable, 'hidePagination', true); diff --git a/src/boot/defaults/setDefault.js b/src/boot/defaults/setDefault.js new file mode 100644 index 000000000..7d56a1a3e --- /dev/null +++ b/src/boot/defaults/setDefault.js @@ -0,0 +1,18 @@ +export default function (component, key, value) { + const prop = component.props[key]; + switch (typeof prop) { + case 'object': + prop.default = value; + break; + case 'function': + component.props[key] = { + type: prop, + default: value, + }; + break; + case 'undefined': + throw new Error('unknown prop: ' + key); + default: + throw new Error('unhandled type: ' + typeof prop); + } +} diff --git a/src/boot/quasar.defaults.js b/src/boot/quasar.defaults.js new file mode 100644 index 000000000..c792100d7 --- /dev/null +++ b/src/boot/quasar.defaults.js @@ -0,0 +1 @@ +export * from './defaults/qTable'; diff --git a/src/components/FilterItemForm.vue b/src/components/FilterItemForm.vue index 4c329a8e8..cd4fff54c 100644 --- a/src/components/FilterItemForm.vue +++ b/src/components/FilterItemForm.vue @@ -202,7 +202,6 @@ const selectItem = ({ id }) => { {