Files
IoTManagerWeb/src/Myinput.svelte

37 lines
1.3 KiB
Svelte
Raw Normal View History

2021-09-16 02:00:52 +08:00
<script context="module">
import { WSpush } from "./App.svelte";
</script>
<script>
export let value;
2021-09-16 02:21:02 +08:00
export let descr;
2021-09-16 02:00:52 +08:00
export let topic;
export let ws;
export let type;
2021-09-17 03:35:49 +08:00
//style="min-width:50%; max-width:100%; width:{value.length * 10}px" on:change={(WSpush(ws, topic, value), console.log(value.length))}
2021-09-16 02:00:52 +08:00
</script>
<div class="container">
<div class="card-items">
2021-09-17 05:27:24 +08:00
<div class="md:w-2/3 lg:w-2/3 2xl:w-2/3">
2021-09-16 02:00:52 +08:00
<!-- svelte-ignore a11y-label-has-associated-control -->
<label class="widget-descr-gray-left">{!descr ? "" : descr}</label>
</div>
2021-09-17 05:27:24 +08:00
<div class="md:w-1/3 lg:w-1/3 2xl:w-1/3">
2021-09-16 02:00:52 +08:00
<!-- on:change={WSpush(ws, topic, value)} -->
{#if type == "number"}
2021-09-17 05:27:24 +08:00
<input class="widget-input-indigo text-right" step="0.1" on:change={WSpush(ws, topic, value)} bind:value type="number" />
2021-09-16 02:00:52 +08:00
{/if}
{#if type == "text"}
2021-09-17 03:35:49 +08:00
<input class="widget-input-indigo text-right" on:change={WSpush(ws, topic, value)} bind:value type="text" />
2021-09-16 02:00:52 +08:00
{/if}
{#if type == "date"}
2021-09-17 03:35:49 +08:00
<input class="widget-input-indigo text-right" on:change={WSpush(ws, topic, value)} bind:value type="date" />
2021-09-16 02:00:52 +08:00
{/if}
{#if type == "time"}
2021-09-17 05:27:24 +08:00
<input class="widget-input-indigo text-right" on:change={WSpush(ws, topic, value)} bind:value type="time" />
2021-09-16 02:00:52 +08:00
{/if}
</div>
</div>
</div>