feat: enhance plugin navigator,add popSelf and popToRoot
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, Group, navigator, modal } from "doric";
|
||||
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, Group, navigator, modal, notification } from "doric";
|
||||
import { colors, label } from "./utils";
|
||||
@Entry
|
||||
class NaivgatorDemo extends Panel {
|
||||
@@ -64,6 +64,46 @@ class NaivgatorDemo extends Panel {
|
||||
navigator(context).pop()
|
||||
},
|
||||
}),
|
||||
label('Register Pop Self').apply({
|
||||
width: 200,
|
||||
height: 50,
|
||||
backgroundColor: colors[0],
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
onClick: () => {
|
||||
notification(context).subscribe({
|
||||
name: "PopSelf",
|
||||
callback: () => {
|
||||
navigator(context).popSelf()
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
label('Send Pop Self').apply({
|
||||
width: 200,
|
||||
height: 50,
|
||||
backgroundColor: colors[0],
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
onClick: () => {
|
||||
notification(context).publish({
|
||||
name: "PopSelf"
|
||||
})
|
||||
},
|
||||
}),
|
||||
label('Back to Root').apply({
|
||||
width: 200,
|
||||
height: 50,
|
||||
backgroundColor: colors[0],
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
onClick: () => {
|
||||
navigator(context).popToRoot()
|
||||
},
|
||||
}),
|
||||
label('OpenURL').apply({
|
||||
width: 200,
|
||||
height: 50,
|
||||
|
Reference in New Issue
Block a user