-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (60 loc) · 1.98 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html class="no-js" lang="en">
<head>
<script type="text/javascript" src="https://cdn.qcobjects.dev/QCObjects.js"></script>
</head>
<body>
<style>
component[name=view-stack]{
border: 1px solid black;
width: 200px;
height: 200px;
position: relative;
display: block;
padding: 0;
}
</style>
<h1>This is a view stack example</h1>
<h2>There are 3 files, view-stack.html , one.html and two.html</h2>
<h3>This part of the page (index.html) does not change when you click in a link</h3>
<p>Open DevTools in your browser (second mouse button, click on Inspect Elements) and see what happens with the elements of this page when you click a link</p>
<view-stack componentClass="CustomComponent" effectClass="MainTransitionEffect">
<routing path="/one" name="page-one" ></routing>
<routing path="/two" name="page-two"></routing>
<routing path="/" name="view-stack"></routing>
<routing path="" name="view-stack"></routing>
</view-stack>
<script>
CONFIG.set("routingWay", "pathname")
Class ("CustomComponent", Component, {
_new_ (o){
var component = this;
component.addComponentHelper(function (){
component.__promise__.then(function (){
// This shows a notification when the content of the current page is fully loaded into the view stack
return Promise.resolve((function (){
// only shows the notification when the current view is page-two
if (component.routingSelected.pop().name=="page-two"){
NotificationComponent.success(`Current View is ${component.routingSelected.pop().name}`);
}
})());
}).catch (function (e){
return Promise.resolve(NotificationComponent.danger("some problem"));
})
});
_super_("Component", "_new_").call(this, o);
}
})
Class("MainTransitionEffect",TransitionEffect,{
duration:2500,
defaultParams:{
alphaFrom:0,
alphaTo:1
},
effects:["Fade","MoveXInFromRight"],
fitToHeight:true
})
RegisterWidget("view-stack")
</script>
</body>
</html>