File tree Expand file tree Collapse file tree 4 files changed +29
-18
lines changed
Expand file tree Collapse file tree 4 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { fade , fly } from ' svelte/transition'
33 import Footer from ' ./Footer.svelte'
4- let logo = false
5- let red = false
6- let x = ' abc?cbd'
4+
5+ let logo = $state (false )
6+ let red = $state (false )
7+ let x = $state (' abc?cbd' )
8+ $inspect (x )
9+ const button = $derived (logo ? ' Hide logo' : ' Show logo' )
10+ const span = $derived (red ? ' Normal' : ' Red' )
11+
712 function toggleLogo() {
813 logo = ! logo
914 }
15+
1016 function toggleSpan() {
1117 red = ! red
1218 }
13- $ : button = logo ? ' Hide logo' : ' Show logo'
14- $ : span = red ? ' Normal' : ' Red'
15- $ : console .log (x )
1619 </script >
1720
1821<main >
2427
2528 <h1 class =" animate-bounce" >Hello Typescript!</h1 >
2629
30+ <h2 class =" text-lg font-semibold text-orange-600" >Use shift+ctrl for the inspector</h2 >
31+
2732 <br />
2833
2934 <div class:bg-red- 400={red }>BG Color should change</div >
3035
3136 <br />
3237
33- <button class ="bg-red-100" on:click ={toggleLogo }>{button }</button >
34- <button on:click ={toggleSpan }>Change BG Color: {span }</button >
38+ <button class ="bg-red-100" onclick ={toggleLogo }>{button }</button >
39+ <button onclick ={toggleSpan }>Change BG Color: {span }</button >
3540
3641 <br />
3742
43+ <input bind:value ={x } type =" text" name =" " id =" " >
44+
3845 <div class =" absolute mt-20px bottom-0" >absolute</div >
3946
4047</main >
4148
4249<Footer />
50+ <Footer foo ={true } name =Footer 2 />
51+ <Footer customclasses ={" bg-blue-500 text-xl" } name =Footer 3 />
4352
4453
4554<style >
Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- let foo = true
2+ const { foo = false , customclasses = " " , name = " Footer " } = $props ()
33 </script >
4+
45<footer >
5- <div
6- class =" bar"
7- class:foo
8- >Footer</div >
9- <div class =" bar" class:foo >Footer2</div >
6+ <div class ="bar {customclasses }" class:foo >{name }</div >
107</footer >
11-
12-
Original file line number Diff line number Diff line change 1+ import { mount } from 'svelte'
12import App from './App.svelte'
23
34import 'uno.css'
45
5- const app = new App ( {
6+ const app = mount ( App , {
67 target : document . getElementById ( 'app' ) ,
78} )
89
Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ import { defineConfig } from 'vite'
66export default defineConfig ( {
77 plugins : [
88 UnoCSS ( ) ,
9- svelte ( ) ,
9+ svelte ( {
10+ inspector : {
11+ toggleKeyCombo : 'control-shift' ,
12+ showToggleButton : 'always' ,
13+ toggleButtonPos : 'bottom-right' ,
14+ } ,
15+ } ) ,
1016 ] ,
1117} )
You can’t perform that action at this time.
0 commit comments