feat:navigator add extra

This commit is contained in:
pengfei.zhou 2019-12-09 20:34:28 +08:00
parent 7d83431d68
commit 59acec6595
2 changed files with 19 additions and 4 deletions

View File

@ -1,8 +1,11 @@
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, IVLayout, Group, IText, navigator } from "doric";
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, IVLayout, Group, IText, navigator, modal } from "doric";
import { colors, label } from "./utils";
@Entry
class NaivgatorDemo extends Panel {
build(root: Group) {
if (this.getInitData()) {
modal(context).alert(`Init Data :${JSON.stringify(this.getInitData())}`)
}
scroller(vlayout([
text({
text: "Navigator Demo",
@ -25,7 +28,12 @@ class NaivgatorDemo extends Panel {
textColor: Color.WHITE,
layoutConfig: layoutConfig().exactly().w(LayoutSpec.AT_MOST),
onClick: () => {
navigator(context).push(`assets://demo/${e}.js`, `${e}.js`)
navigator(context).push(`assets://demo/${e}.js`, {
alias: `${e}.js`,
extra: {
from: "navigatorDemo"
},
})
},
} as IText)
),

View File

@ -1,4 +1,4 @@
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, stack, hlayout, text, IHLayout, CENTER, slider, slideItem, modal, Slider, Text, Color, View, Stack, animate, flowlayout, FlowLayoutItem, NestedSlider } from "doric";
import { Panel, Group, scroller, vlayout, image, layoutConfig, LayoutSpec, Input, Gravity, log, stack, hlayout, text, IHLayout, CENTER, slider, slideItem, modal, Slider, Text, Color, View, Stack, animate, flowlayout, FlowLayoutItem, NestedSlider, ScaleType } from "doric";
import { title, colors } from "./utils";
function tab(idx: number, title: string, sliderView: Slider) {
@ -25,7 +25,14 @@ class StickDemo extends Panel {
scroller(
vlayout([
stack([]).apply({
stack([
image({
layoutConfig: layoutConfig().atmost(),
imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp",
scaleType: ScaleType.ScaleAspectFill,
}),
]).apply({
layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY),
height: 200,
backgroundColor: colors[0],