debian-mirror-gitlab/app/assets/javascripts/vue_alerts.js

23 lines
535 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue';
const mountVueAlert = el => {
const props = {
html: el.innerHTML,
};
const attrs = {
...el.dataset,
dismissible: parseBoolean(el.dataset.dismissible),
};
return new Vue({
el,
render(h) {
return h(DismissibleAlert, { props, attrs });
},
});
};
export default () => [...document.querySelectorAll('.js-vue-alert')].map(mountVueAlert);