瀏覽代碼

Merge branch 'DioxusLabs:master' into lazy_tui

Demonthos 3 年之前
父節點
當前提交
f4689a4e27

+ 1 - 1
docs/guide/src/state/localstate.md

@@ -19,8 +19,8 @@ cx.render(rsx!{
     ul {
     ul {
         todos.read().iter().enumerate().map(|(id, todo)| rsx!{
         todos.read().iter().enumerate().map(|(id, todo)| rsx!{
             li {
             li {
+                onhover: move |_| *todos.write()[id].is_hovered = true,
                 h1 { "{todo.contents}" }
                 h1 { "{todo.contents}" }
-                onhover: move |_| *todos.write()[id].is_hovered = true;
             }
             }
         })
         })
     }
     }

+ 3 - 3
docs/reference/src/platforms/mobile.md

@@ -1,15 +1,15 @@
 # Getting started: mobile
 # Getting started: mobile
 
 
 
 
-Dioxus is unique in that it actually supports mobile. However, support is very young and you might need to dip down into some of the primitives until better supported is ready.
+Dioxus is unique in that it actually supports mobile. However, support is very young and you might need to dip down into some of the primitives until better support is ready.
 
 
-Currently, only iOS is supported through us, however you *can* add android support by following the same instructions below, but using the `android` guide in `cargo-mobile`.
+Currently, only iOS is supported through us, however you *can* add android support by following the same instructions below by using the `android` guide in `cargo-mobile`.
 
 
 Also, Dioxus Desktop and Dioxus Mobile share the same codebase, and dioxus-mobile currently just re-exports dioxus-desktop.
 Also, Dioxus Desktop and Dioxus Mobile share the same codebase, and dioxus-mobile currently just re-exports dioxus-desktop.
 
 
 ## Getting Set up
 ## Getting Set up
 
 
-Getting set up with mobile can but quite challenging. The tooling here isn't great (yet) and might take some hacking around to get things working. macOS M1 is broadly unexplored and might not work for you.
+Getting set up with mobile can be quite challenging. The tooling here isn't great (yet) and might take some hacking around to get things working. macOS M1 is broadly unexplored and might not work for you.
 
 
 We're going to be using `cargo-mobile` to build for mobile. First, install it:
 We're going to be using `cargo-mobile` to build for mobile. First, install it:
 
 

+ 1 - 1
docs/reference/src/platforms/web.md

@@ -77,7 +77,7 @@ trunk serve
 To build our app and publish it to Github:
 To build our app and publish it to Github:
 
 
 - Make sure Github Pages is set up for your repo
 - Make sure Github Pages is set up for your repo
-- Build your app with `trunk build --release`
+- Build your app with `trunk build --release` (include `--public-url <repo-name>` to update asset prefixes if using a project site)
 - Move your generated HTML/CSS/JS/Wasm from `dist` into the folder configured for Github Pages
 - Move your generated HTML/CSS/JS/Wasm from `dist` into the folder configured for Github Pages
 - Add and commit with git
 - Add and commit with git
 - Push to Github
 - Push to Github

+ 5 - 5
notes/README/ZH_CN.md

@@ -65,13 +65,13 @@ Dioxus 是一个可移植、高性能的框架,用于在 Rust 中构建跨平
 
 
 ```rust
 ```rust
 fn app(cx: Scope) -> Element {
 fn app(cx: Scope) -> Element {
-    let (count, set_count) = use_state(&cx, || 0);
+    let mut count = use_state(&cx, || 0);
 
 
-    cx.render(rsx!(
+    cx.render(rsx! {
         h1 { "High-Five counter: {count}" }
         h1 { "High-Five counter: {count}" }
-        button { onclick: move |_| set_count(count + 1), "Up high!" }
-        button { onclick: move |_| set_count(count - 1), "Down low!" }
-    ))
+        button { onclick: move |_| count += 1, "Up high!" }
+        button { onclick: move |_| count -= 1, "Down low!" }
+    })
 }
 }
 ```
 ```
 
 

+ 5 - 0
packages/core-macro/src/inlineprops.rs

@@ -7,6 +7,7 @@ use syn::{
 };
 };
 
 
 pub struct InlinePropsBody {
 pub struct InlinePropsBody {
+    pub attrs: Vec<Attribute>,
     pub vis: syn::Visibility,
     pub vis: syn::Visibility,
     pub fn_token: Token![fn],
     pub fn_token: Token![fn],
     pub ident: Ident,
     pub ident: Ident,
@@ -22,6 +23,7 @@ pub struct InlinePropsBody {
 /// The custom rusty variant of parsing rsx!
 /// The custom rusty variant of parsing rsx!
 impl Parse for InlinePropsBody {
 impl Parse for InlinePropsBody {
     fn parse(input: ParseStream) -> Result<Self> {
     fn parse(input: ParseStream) -> Result<Self> {
+        let attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
         let vis: Visibility = input.parse()?;
         let vis: Visibility = input.parse()?;
 
 
         let fn_token = input.parse()?;
         let fn_token = input.parse()?;
@@ -57,6 +59,7 @@ impl Parse for InlinePropsBody {
             output,
             output,
             block,
             block,
             cx_token,
             cx_token,
+            attrs,
         })
         })
     }
     }
 }
 }
@@ -72,6 +75,7 @@ impl ToTokens for InlinePropsBody {
             output,
             output,
             block,
             block,
             cx_token,
             cx_token,
+            attrs,
             ..
             ..
         } = self;
         } = self;
 
 
@@ -136,6 +140,7 @@ impl ToTokens for InlinePropsBody {
                 #(#fields),*
                 #(#fields),*
             }
             }
 
 
+            #(#attrs)*
             #vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output {
             #vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output {
                 let #struct_name { #(#field_names),* } = &cx.props;
                 let #struct_name { #(#field_names),* } = &cx.props;
                 #block
                 #block

+ 1 - 1
packages/core/src/nodes.rs

@@ -508,7 +508,7 @@ impl<'a> NodeFactory<'a> {
         }
         }
     }
     }
 
 
-    /// Get the custom alloactor for this component
+    /// Get the custom allocator for this component
     #[inline]
     #[inline]
     pub fn bump(&self) -> &'a bumpalo::Bump {
     pub fn bump(&self) -> &'a bumpalo::Bump {
         self.bump
         self.bump