mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 12:15:20 +08:00
27 lines
574 B
JavaScript
27 lines
574 B
JavaScript
|
|
import $ from '$';
|
|
|
|
let cachedUrl = null;
|
|
const getUrl = () => {
|
|
if (!cachedUrl)
|
|
{
|
|
const version = $('#rlAppVersion').attr('content') || '0.0.0';
|
|
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
|
}
|
|
|
|
return cachedUrl;
|
|
};
|
|
|
|
export default {
|
|
template: '<b></b>',
|
|
viewModel: {
|
|
createViewModel: ({icon = 'null'}, componentInfo) => {
|
|
if (componentInfo && componentInfo.element)
|
|
{
|
|
$(componentInfo.element).replaceWith(
|
|
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
|
);
|
|
}
|
|
}
|
|
}
|
|
};
|