mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 23:12:34 +03:00
event passing from and to child component example
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
<script context="module">
|
||||
export function WSpush(arg) {
|
||||
console.log(arg);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { onMount } from "svelte";
|
||||
//роутер ==========================================
|
||||
import { Route, router, active } from "tinro";
|
||||
router.mode.hash(); // enables hash navigation method
|
||||
@@ -6,6 +13,10 @@
|
||||
import Card from "./Card.svelte";
|
||||
import Input from "./Input.svelte";
|
||||
|
||||
onMount(async () => {
|
||||
WSpush("mounted");
|
||||
});
|
||||
|
||||
let wigets = [];
|
||||
|
||||
wigets = [
|
||||
@@ -37,10 +48,6 @@
|
||||
topic: "/prefix/00000-00000/temp3",
|
||||
},
|
||||
];
|
||||
|
||||
function WSpush(ws, uri, val) {
|
||||
console.log(ws + " " + uri + " " + val);
|
||||
}
|
||||
</script>
|
||||
|
||||
<main>
|
||||
@@ -102,7 +109,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Сеть </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" value="your SSID" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" value="your SSID" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:flex md:items-center mb-6">
|
||||
@@ -110,7 +117,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-password"> Пароль </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-password" type="password" placeholder="******************" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="password" placeholder="******************" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:flex md:items-center mb-6">
|
||||
@@ -134,7 +141,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Сервер </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" value="your SSID" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" value="your SSID" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -143,7 +150,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Порт </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" value="your SSID" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" value="your SSID" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -152,7 +159,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Префикс </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" value="your SSID" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" value="your SSID" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,7 +168,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Пользователь </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" value="your SSID" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" value="your SSID" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +177,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-password"> Пароль </label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-password" type="password" placeholder="******************" />
|
||||
<input class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="password" placeholder="******************" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<script context="module">
|
||||
import { WSpush } from "./App.svelte";
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export let title;
|
||||
export let value;
|
||||
//on:input={sendInputText}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
@@ -10,7 +13,7 @@
|
||||
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name">{title}</label>
|
||||
</div>
|
||||
<div class="md:w-2/3">
|
||||
<input bind:value class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" />
|
||||
<input bind:value on:change={WSpush(value)} class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user