Commit a987ba03 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'fe-deprecate-mount-component-helper' into 'master'

Deprecate vue mount component helper

See merge request gitlab-org/gitlab!31698
parents 8fbef813 212b4838
import Vue from 'vue'; import Vue from 'vue';
/**
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
*/
const mountComponent = (Component, props = {}, el = null) => const mountComponent = (Component, props = {}, el = null) =>
new Component({ new Component({
propsData: props, propsData: props,
}).$mount(el); }).$mount(el);
/**
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
*/
export const createComponentWithStore = (Component, store, propsData = {}) => export const createComponentWithStore = (Component, store, propsData = {}) =>
new Component({ new Component({
store, store,
propsData, propsData,
}); });
/**
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
*/
export const mountComponentWithStore = (Component, { el, props, store }) => export const mountComponentWithStore = (Component, { el, props, store }) =>
new Component({ new Component({
store, store,
propsData: props || {}, propsData: props || {},
}).$mount(el); }).$mount(el);
/**
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
*/
export const mountComponentWithSlots = (Component, { props, slots }) => { export const mountComponentWithSlots = (Component, { props, slots }) => {
const component = new Component({ const component = new Component({
propsData: props || {}, propsData: props || {},
...@@ -30,9 +46,18 @@ export const mountComponentWithSlots = (Component, { props, slots }) => { ...@@ -30,9 +46,18 @@ export const mountComponentWithSlots = (Component, { props, slots }) => {
/** /**
* Mount a component with the given render method. * Mount a component with the given render method.
* *
* -----------------------------
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
* -----------------------------
*
* This helps with inserting slots that need to be compiled. * This helps with inserting slots that need to be compiled.
*/ */
export const mountComponentWithRender = (render, el = null) => export const mountComponentWithRender = (render, el = null) =>
mountComponent(Vue.extend({ render }), {}, el); mountComponent(Vue.extend({ render }), {}, el);
/**
* Deprecated. Please do not use.
* Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
*/
export default mountComponent; export default mountComponent;
import Vue from 'vue'; export { default } from '../../frontend/helpers/vue_mount_component_helper';
export * from '../../frontend/helpers/vue_mount_component_helper';
const mountComponent = (Component, props = {}, el = null) =>
new Component({
propsData: props,
}).$mount(el);
export const createComponentWithStore = (Component, store, propsData = {}) =>
new Component({
store,
propsData,
});
export const mountComponentWithStore = (Component, { el, props, store }) =>
new Component({
store,
propsData: props || {},
}).$mount(el);
export const mountComponentWithSlots = (Component, { props, slots }) => {
const component = new Component({
propsData: props || {},
});
component.$slots = slots;
return component.$mount();
};
/**
* Mount a component with the given render method.
*
* This helps with inserting slots that need to be compiled.
*/
export const mountComponentWithRender = (render, el = null) =>
mountComponent(Vue.extend({ render }), {}, el);
export default mountComponent;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment