fix FormValue

This commit is contained in:
ealmloff 2023-11-14 10:52:39 -06:00 committed by GitHub
parent 20bbf95979
commit 4631050a04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,7 @@ use dioxus_html::geometry::{
use dioxus_html::input_data::keyboard_types::{Code, Key, Location, Modifiers}; use dioxus_html::input_data::keyboard_types::{Code, Key, Location, Modifiers};
use dioxus_html::input_data::MouseButtonSet as DioxusMouseButtons; use dioxus_html::input_data::MouseButtonSet as DioxusMouseButtons;
use dioxus_html::input_data::{MouseButton as DioxusMouseButton, MouseButtonSet}; use dioxus_html::input_data::{MouseButton as DioxusMouseButton, MouseButtonSet};
use dioxus_html::{event_bubbles, FocusData, KeyboardData, MouseData, ValueType, WheelData}; use dioxus_html::{event_bubbles, FocusData, KeyboardData, MouseData, FormValue, WheelData};
use std::any::Any; use std::any::Any;
use std::collections::HashMap; use std::collections::HashMap;
use std::{ use std::{
@ -61,7 +61,7 @@ impl EventData {
pub struct FormData { pub struct FormData {
pub value: String, pub value: String,
pub values: HashMap<String, ValueType>, pub values: HashMap<String, FormValue>,
pub files: Option<Files>, pub files: Option<Files>,
} }

View file

@ -10,7 +10,7 @@
use dioxus_core::{ use dioxus_core::{
BorrowedAttributeValue, ElementId, Mutation, Template, TemplateAttribute, TemplateNode, BorrowedAttributeValue, ElementId, Mutation, Template, TemplateAttribute, TemplateNode,
}; };
use dioxus_html::{event_bubbles, CompositionData, FormData, MountedData, ValueType}; use dioxus_html::{event_bubbles, CompositionData, FormData, MountedData, FormValue};
use dioxus_interpreter_js::{get_node, minimal_bindings, save_template, Channel}; use dioxus_interpreter_js::{get_node, minimal_bindings, save_template, Channel};
use futures_channel::mpsc; use futures_channel::mpsc;
use js_sys::Array; use js_sys::Array;
@ -377,9 +377,9 @@ fn read_input_to_data(target: Element) -> Rc<FormData> {
let item_values: Vec<String> = let item_values: Vec<String> =
item_values.iter().filter_map(|v| v.as_string()).collect(); item_values.iter().filter_map(|v| v.as_string()).collect();
values.insert(name, ValueType::VecText(item_values)); values.insert(name, FormValue::VecText(item_values));
} else if let Ok(item_value) = array.get(1).dyn_into::<JsValue>() { } else if let Ok(item_value) = array.get(1).dyn_into::<JsValue>() {
values.insert(name, ValueType::Text(item_value.as_string().unwrap())); values.insert(name, FormValue::Text(item_value.as_string().unwrap()));
} }
} }
} }