Vuetify updates
This commit is contained in:
parent
c913a40e18
commit
c47b975723
43 changed files with 197 additions and 150 deletions
|
|
@ -1,30 +1,69 @@
|
|||
import {createVuetify } from "vuetify";
|
||||
import { createVuetify } from "vuetify";
|
||||
import * as components from "vuetify/components";
|
||||
import * as directives from "vuetify/directives";
|
||||
import { aliases, md } from "vuetify/iconsets/md";
|
||||
import { h } from "vue";
|
||||
|
||||
// Import all .vue icons and process them, so they can be used
|
||||
// as $vuetify.icons.<iconname>
|
||||
var icons = {}
|
||||
const modules = import.meta.glob('@/assets/icons/*.vue', {eager: true});
|
||||
Object.keys(modules).map(path => {
|
||||
var icons = {};
|
||||
var customAliases = {};
|
||||
const modules = import.meta.glob("@/assets/icons/*.vue", { eager: true });
|
||||
Object.keys(modules).map((path) => {
|
||||
// Remove"./"
|
||||
const parts = path.split("/");
|
||||
const iconName = parts[parts.length - 1].split(".")[0];
|
||||
icons[iconName] = { component: modules[path].default }
|
||||
icons[iconName] = { component: modules[path].default };
|
||||
customAliases["vuetify.icons." + iconName] = "custom:" + iconName;
|
||||
});
|
||||
|
||||
export default function(ignoredconfig) {
|
||||
return createVuetify({
|
||||
const custom = {
|
||||
component: (props) => {
|
||||
const {
|
||||
icon,
|
||||
...rest
|
||||
} = props;
|
||||
const stringIcon = icon;
|
||||
if (icons[stringIcon]) {
|
||||
return h(props.tag, rest, [h(icons[stringIcon].component)]);
|
||||
}
|
||||
return md.component(props);
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
install(app, ignoredOptions) {
|
||||
const options = {
|
||||
components,
|
||||
directives,
|
||||
icons: {
|
||||
iconfont: 'md',
|
||||
values: icons,
|
||||
defaultSet: "md",
|
||||
aliases: {
|
||||
...aliases,
|
||||
...customAliases,
|
||||
},
|
||||
sets: {
|
||||
md, custom,
|
||||
},
|
||||
},
|
||||
options: {
|
||||
customProperties: true
|
||||
defaults: {
|
||||
global: {
|
||||
density: "comfortable",
|
||||
},
|
||||
VBtn: {
|
||||
variant: "flat",
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
options: {
|
||||
customProperties: true,
|
||||
},
|
||||
dark: false,
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
const vuetify = createVuetify(options);
|
||||
app.use(vuetify);
|
||||
app.config.globalProperties.$vuetify = vuetify;
|
||||
app.$vuetify = vuetify;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue