leptos_element_plus

Crates.ioleptos_element_plus
lib.rsleptos_element_plus
version0.0.6
sourcesrc
created_at2023-11-04 18:38:20.739799
updated_at2023-12-18 09:35:30.135908
descriptionA wrapper of element-plus for leptos
homepage
repository
max_upload_size
id1025373
size1,164,324
(joey-xm)

documentation

README

A wrapper of Element Plus for Leptos.

Explore the combination of Vue components with Leptos,it’s simply for the sake of reusing the wheel.

A Simple

main.rs
mod app;

use leptos::*;
use leptos_meta::provide_meta_context;

use app::*;
use leptos_element_plus::ElementPlusSetup;

fn main() {
    _ = console_log::init_with_level(log::Level::Debug);

    provide_meta_context();
    mount_to_body(|| {
        view! {
            <ElementPlusSetup/>
            <App/>
        }
    })
}
app.rs
use leptos::*;
use leptos::logging::log;
use js_sys::Date;

use leptos_element_plus::components::el_date_time_picker::DateTimePicker;

#[component]
pub fn App() -> impl IntoView {
    let date = create_rw_signal(Date::new_0());
    create_effect(move|_| {
        log!("date: {:?}", date.get().to_string());
    });
    view! {
        <div class="flex flex-col p-6 space-y-4">
            <DateTimePicker
                value=date
                placeholder="Select date and time"
            />
        </div>
    }
}
Commit count: 0

cargo fmt