<svgue mode="usingIds" path="/icons" icon="logo" useId="myIcon" width="30px" height="30px" />
<svgue path="/icons" icon="logo" mode="usingAxios" width="30px" height="30px" />
// твой main.ts file
import {createApp} from 'vue'
import App from './App.vue'
import {defineConfig} from "svgue";
import axios from "axios"; // or import your axios instance and pass it to the config.
const app = createApp(App)
defineConfig({
path: '/assets/img/icons/',
axiosInstance: axios.create()
}, app)
app.mount('#app')
const defineConfig = (options) => {
window.$myPluginConfig = options;
};
const app = createApp(App)
defineConfig({
iconsBasePath: '/'
}, app)
app.mount('#app')
const app = createApp(App)
app.use(MyLib)
.mount('#app')
// файл конфигурации, например, my-lib.config.js
import {defineConfig} from 'my-lib'
export default defineConfig({
iconsBasePath: '/'
})
// mylib.config.js
export default defineConfig({
iconsBasePath: 'public/icons'
})
enum MyComponents {
one = "ComponentOne",
two = "ComponentTwo",
three = "ComponentThree",
}
const currentComponent = shallowRef()
onMounted(async () => {
const component = await axios.get()
switch (component) {
case MyComponents.one: currentComponent .value = ComponentOne,
break
case MyComponents.two: currentComponent .value = ComponentTwo
break
case MyComponents.three: currentComponent .value = ComponentThree
break
}
})
enum IRores {
ADMIN = 'admin',
MODERATOR='moderator',
USER = 'user',
BLACK_USER='black_user'
}
enum IPermissions{
WRITE = 'write',
READ = 'read',
UPDATE='update'
DELETE='delete'
ALL='all'
}
const ROLES_PERMISSIONS = new Map([
[IRoles.Admin, [IPermissions.ALL]],
[IRoles.MODERATOR, [IPermissions.READ, IPermissions.WRITE, IPermissions.UPDATE],
[IRoles.USER , [IPermissions.READ, IPermissions.WRITE]],
[IRoles.BLACK_USER, [IPermissions.READ]],
])
const currentUserPermissions = ROLES_PERMISSIONS.get(currentUser.role)
<div v-if="currentUserPermissions.includes(ROLES_PERMISSIONS.DELETE)">some content</div>
enum IRores {
ADMIN = 'admin',
USER = 'user'
}
<div v-if="currentUser.role === IRoles.ADMIN"></div
<div :v-role="[IRoles.ADMIN]"></div
const switcher = ref(widget.active)
const emits = defineEmits<{
(e: 'editWidget', param: any) : void
}>()
<el-switch size="small" v-model="switcher" inline-prompt/>
watch(switcher , () => {
emits('editWidget', switcher.value)
})
@import file-with-media from './'
... а потом тут переопределены стили контейнеров которые подпадают под медиа запросы
в какой папке иконки? если используешь vite, ложи в public/icons.
Ниже как должно у тебя работать