mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-04 14:02:17 +08:00
30 lines
618 B
JavaScript
30 lines
618 B
JavaScript
|
|
import {$} from 'common';
|
|
|
|
let
|
|
cachedUrl = null,
|
|
getUtl = () => {
|
|
if (!cachedUrl)
|
|
{
|
|
const version = $('#rlAppVersion').attr('content') || '0.0.0';
|
|
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
|
}
|
|
|
|
return cachedUrl;
|
|
}
|
|
;
|
|
|
|
module.exports = {
|
|
template: '<b></b>',
|
|
viewModel: {
|
|
createViewModel: (params, componentInfo) => {
|
|
if (componentInfo && componentInfo.element)
|
|
{
|
|
const icon = params.icon || 'null';
|
|
$(componentInfo.element).replaceWith(
|
|
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUtl()}#svg-icon-${icon}"></use></svg>`
|
|
);
|
|
}
|
|
}
|
|
}
|
|
};
|