svelte Questions
3
Solved
I'm trying to implement TypeScript into Svelte and has a problem like this: when I try to add type to an event in beneath line:
on:click={(e: Event) => onClick(e, data)}
it yells about:
Error:...
Sleight asked 10/8, 2020 at 9:49
5
Solved
Sveltekit has very strict a11y checks, for instance you can't just add on:click to a div.
I can suppress it on a per-line bases, e.g.:
<!-- svelte-ignore a11y-click-events-have-key-events -->...
Covenantor asked 20/11, 2023 at 19:33
2
So it looks like I have to separately type the response body going out of an endpoint and the props that I get from that body in the component. For example:
// index.ts (endpoint)
import type { Re...
Tropho asked 16/6, 2022 at 3:42
3
Solved
I have this code:
<select class="form-control" on:change={pathChanged}>
The signature for pathChanged is:
function pathChanged(event: { target: HTMLSelectElement }) {
When I run t...
Dail asked 22/5, 2022 at 17:17
3
Solved
I'm using Typescript inside my svelte project, I need to define strong type for my event. But I can't find any way to do that.
<script lang="ts">
const onKeyUp = (event: [type here...
Lucarne asked 19/11, 2021 at 7:19
3
Solved
Hello I am new to Svelte, Sapper & Express.
The problem:
I am using Sappers _layout.html to display 2 components (header & menu) that should be displayed on all pages, save for the login p...
Brandeebranden asked 27/11, 2018 at 7:52
4
Solved
I am new to VS Code and JavaScript, and I am trying to make a simple app using Vite and Svelte, but I have a problem which I can't seem to resolve. (My code is currently just the default code given...
Leavenworth asked 2/5, 2022 at 16:15
4
In my SvelteKit project I am using SCSS and in order to include some mixins that are used throughout the project, I switched from vitePreprocess to svelte-preprocess and prepended them with scss.pr...
7
Solved
I'm using clickOutside directive on my svelte-typescript project and I'm getting this error when I assign custom event to the related element
Type '{ class: string; onclick_outside: () => boolea...
Greylag asked 30/9, 2020 at 4:59
9
I'm having a devil of a time figuring out how to build a single .js file from Vite in my Svelte project that includes all of the built javascript and CSS from my Svelte projects. By default, Vite b...
Fledgy asked 31/5, 2021 at 23:36
3
Solved
I am building a site with SvelteKit. As of now I included Bootstrap 5 in my project by adding it to the app.html file provided by the SvelteKit Skeleton project:
<!-- Bootstrap styles and javasc...
Corkage asked 10/8, 2023 at 16:3
4
I am really new to Svelte, but cannot find answer to my question anywhere.
I am trying to use this React component in Svelte:
https://developer.microsoft.com/en-us/fabric#/controls/web/stack
(I gu...
Hax asked 26/5, 2019 at 11:50
2
Solved
I'm trying to import enums, objects, functions, and svelte components by using absolute paths to files, but the compiler can't find them.
This is how i do the imports:
<script lang=ts>
impor...
Karlis asked 17/9, 2022 at 12:19
3
Solved
I have an api that returns html with classes, I want to know how I can use svelte style definition for those.
App.Svelte
<script>
let string = `<span class="status">ok</span>`;...
Aventurine asked 18/3, 2020 at 7:0
6
Solved
I have a page with a search field. If accessed with a query parameter (e.g. ?word=cat) the page should load with results present and the search field filled. If a search is done the results and the...
1
Solved
Svelte 5 Slots are Confusing
Now, with Svelte 5 at pre-release, I feel I can express some confusion about slots in Svelte 5. In Svelte 4, slot and names slots where done in the following way:
Conta...
Iniquity asked 24/6 at 18:22
4
I'm trying to create a new app using SvelteKit & Cloudflare Pages and I'm struggling with running the application locally in a proper manner. Currently, in order to get the app running locally ...
Davies asked 23/12, 2022 at 22:43
9
I am trying to containerise Svelte js app inside a docker container and I am getting this error on the log complaining about esbuild in a different platform , I am using M1 mac, I have tried to ins...
Corin asked 27/7, 2022 at 14:19
4
Solved
I've already gotten my fair share of Bootstrap and Django but never tried out other frontend frameworks like Angular, React, etc. and finally wanted to try SvelteKit. So I'm really inexperienced an...
Unread asked 5/6, 2022 at 21:10
3
Solved
Is it possible to use a conditional statement to wrap inner content with an optional outer element?
Here is an example of what I want to do in valid Svelte:
<script>
export let needs_div_wra...
Manhole asked 28/11, 2020 at 19:3
3
Solved
I want to developt my own Button component and be able to handle event modifiers, like this:
<MyButton on:click|preventDefault={handler}>Click me</MyButton>
But I get the following err...
Transcendent asked 19/10, 2021 at 11:59
8
Solved
How would I do something like this:
<style>
Nested {
color: blue;
}
</style>
<Nested />
i.e. How do I apply a style to a component from its parent?
Imputation asked 11/7, 2019 at 12:1
4
Using @sveltejs/adapter-node: 1.0.0-next.61 and @sveltejs/kit: ^1.0.0-next.225
The following issue occurs only on the build version of the app, and not on the dev server, on which it doesn't occur....
Shivers asked 22/3, 2022 at 9:0
3
Solved
I'm learning SvelteKit and this might be a very elementary question. But I could not figure out how to change the tab's title.
In my src/+layout.svelte I have:
<script>
let title="My S...
6
I'm very new to svelte ( like many of us ^^ ), and I didn't manage to add bootstrap to my app. Tried to run 'npm add bootstrap' but it said that I need peer jquery dependencie. Here is the terminal...
Straighten asked 21/1, 2020 at 13:44
1 Next >
© 2022 - 2024 — McMap. All rights reserved.