mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-02-23 17:49:49 +08:00
201 lines
5.0 KiB
JSON
201 lines
5.0 KiB
JSON
{
|
|
"app": {
|
|
"version": "example/v1",
|
|
"metadata": {
|
|
"name": "hash_router",
|
|
"description": "hash router example"
|
|
},
|
|
"spec": {
|
|
"components": [
|
|
{
|
|
"id": "router",
|
|
"type": "core/v1/router",
|
|
"properties": {
|
|
"switchPolicy": [
|
|
{
|
|
"type": "route",
|
|
"path": "/react",
|
|
"slotId": "text_react",
|
|
"default": true
|
|
},
|
|
{
|
|
"type": "route",
|
|
"path": "/angular",
|
|
"slotId": "text_ng",
|
|
"default": false
|
|
},
|
|
{
|
|
"type": "route",
|
|
"path": "/vue",
|
|
"slotId": "text_vue",
|
|
"default": false
|
|
},
|
|
{
|
|
"type": "redirect",
|
|
"path": "/redirect",
|
|
"href": "/angular"
|
|
}
|
|
]
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/state",
|
|
"properties": {
|
|
"key": "index",
|
|
"initialValue": 0
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "text_react",
|
|
"type": "core/v1/text",
|
|
"properties": {
|
|
"value": {
|
|
"raw": "React",
|
|
"format": "plain"
|
|
}
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/slot",
|
|
"properties": {
|
|
"container": {
|
|
"id": "router",
|
|
"slot": "text_react"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "text_ng",
|
|
"type": "core/v1/text",
|
|
"properties": {
|
|
"value": {
|
|
"raw": "Angular",
|
|
"format": "plain"
|
|
}
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/slot",
|
|
"properties": {
|
|
"container": {
|
|
"id": "router",
|
|
"slot": "text_ng"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "text_vue",
|
|
"type": "core/v1/text",
|
|
"properties": {
|
|
"value": {
|
|
"raw": "Vue",
|
|
"format": "plain"
|
|
}
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/slot",
|
|
"properties": {
|
|
"container": {
|
|
"id": "router",
|
|
"slot": "text_vue"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "switch_button",
|
|
"type": "plain/v1/button",
|
|
"properties": {
|
|
"text": {
|
|
"raw": "switch",
|
|
"format": "plain"
|
|
}
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/event",
|
|
"properties": {
|
|
"handlers": [
|
|
{
|
|
"type": "onClick",
|
|
"componentId": "router",
|
|
"method": {
|
|
"name": "setValue",
|
|
"parameters": {
|
|
"key": "index",
|
|
"value": "{{router.index + 1}}"
|
|
}
|
|
},
|
|
"wait": {},
|
|
"disabled": false
|
|
},
|
|
{
|
|
"type": "onClick",
|
|
"componentId": "router",
|
|
"method": {
|
|
"name": "navigate",
|
|
"parameters": "{{['/','/vue','/angular'][router.index%3]}}"
|
|
},
|
|
"wait": {},
|
|
"disabled": false
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "redirect_button",
|
|
"type": "plain/v1/button",
|
|
"properties": {
|
|
"text": {
|
|
"raw": "redirect",
|
|
"format": "plain"
|
|
}
|
|
},
|
|
"traits": [
|
|
{
|
|
"type": "core/v1/event",
|
|
"properties": {
|
|
"handlers": [
|
|
{
|
|
"type": "onClick",
|
|
"componentId": "router",
|
|
"method": {
|
|
"name": "setValue",
|
|
"parameters": {
|
|
"key": "index",
|
|
"value": "2"
|
|
}
|
|
},
|
|
"wait": {},
|
|
"disabled": false
|
|
},
|
|
{
|
|
"type": "onClick",
|
|
"componentId": "router",
|
|
"method": {
|
|
"name": "navigate",
|
|
"parameters": "/redirect"
|
|
},
|
|
"wait": {},
|
|
"disabled": false
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|