Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to import material web component to svelte project

$
0
0

I'm new to svelte and having some problem to import material web component to svelte project.

First it seems works fine when project first run with imported components (like tabs,buttons... )

<script lang="ts">    import '@material/web/all';    $: tabIndex = 0;    function handleChange(event: any) {        tabIndex = event.target.activeTabIndex;    }</script><div><md-tabs on:change={handleChange}><md-primary-tab active={tabIndex == 0}>A</md-primary-tab><md-primary-tab active={tabIndex == 1}>B</md-primary-tab><md-primary-tab active={tabIndex == 2}>C</md-primary-tab></md-tabs></div>

But those components cannot receive DOM event at on:{eventname} keywords.

Other svelte components (like svelte material ui) works fine.

Is there any misunderstands about svelte? or vanilla js components(material web) just cannot use svelte? if then, is there any solution?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>