JavaScript
2
Вклад в тег
<my-component answer="99"></my-component>
// mount-helper.js
export function mount(target, Component) {
return new Component({
target,
props: target.dataset
});
}
<div id="my-component" data-answer="99"></div>
import { mount } from './mount-helper.js';
import MyComponent from './MyComponent.svelte';
mount(document.getElementById('my-component'), MyComponent);