Quick to implement, hard to get rid of
Bad user experience (performance, links)
😌
😱
new Vue({
el: "#element",
render: MyComponent
})ComponentRegistry.load('MyComponent')
.then(function (MyComponent: Vue) {
// use MyComponent
});Webpack build
TSX component:
Bundle chunks
runtime.bc05e222.js
lib-ui.dc71160a.js
my-component.d5e5b31b.js
🚀
MyComponent
+ 🔮
// legacy
ComponentRegistry.registerScripts(
"MyComponent",
[
"runtime.bc05e222.js",
"lib-ui.dc71160a.js",
"my-component.d5e5b31b.js"
]
);// in Webpack
// instead of "new Vue({})"
ComponentRegistry.registerComponent(
'MyComponent',
MyComponent
);ComponentRegistry.load('MyComponent')
.then(function (MyComponent: Vue) {
const instance = new MyComponent({
el: '#target-element',
propsData: {
prop1: 'foo',
prop2: 123
}
});
instance.$on('save', function() {
console.log(this.prop1, this.prop2);
});
});🔮😱