File tree 1 file changed +56
-43
lines changed 1 file changed +56
-43
lines changed Original file line number Diff line number Diff line change 1
1
<div>
2
- {{#request
3
- src="/api/test"
4
- method="get"
5
- after="click:.target"
6
- repeat=true
7
- interval=1000
8
- indicators=[
9
- {
10
- trigger: "pending"
11
- content: "<p>Loading...</p>"
12
- },
13
- {
14
- trigger: "rejected"
15
- content: "<p>Error</p><button>reload</button>"
16
- }
17
- ]
18
- autoBody={
19
- formData: true
20
- }
21
- memo=true
22
- initId="id1"
23
- allowedContentTypes=["text/html"]
24
- disallowedTags=["script" "style" "iframe"]
25
- sanitize=false
26
- }}{{/request}}
27
- {{r src="/api/test2"}}{{/r}}
28
- {{#request
29
- src="/api/register"
30
- after="submit:#form"
31
- repeat=false
32
- indicators=[
33
- {
34
- trigger: "pending",
35
- content: "<p>Loading...</p>"
36
- }
37
- ]
38
- }}
39
- {{/request}}
2
+ {{#request
3
+ src="/api/test"
4
+ method="get"
5
+ after="click:.target"
6
+ repeat=true
7
+ interval=1000
8
+ indicators=[
9
+ {
10
+ trigger: "pending",
11
+ // Use a wrapper with fixed width to prevent layout shift
12
+ content: "<p><span class='loading-wrap'>Loading...</span></p>"
13
+ },
14
+ {
15
+ trigger: "rejected",
16
+ // Same wrapper used here to maintain equal width
17
+ content: "<p><span class='loading-wrap'>Error</span></p><button>reload</button>"
18
+ }
19
+ ]
20
+ autoBody={
21
+ formData: true
22
+ }
23
+ memo=true
24
+ initId="id1"
25
+ allowedContentTypes=["text/html"]
26
+ disallowedTags=["script" "style" "iframe"]
27
+ sanitize=false
28
+ }}{{/request}}
29
+
30
+ {{r src="/api/test2"}}{{/r}}
31
+
32
+ {{#request
33
+ src="/api/register"
34
+ after="submit:#form"
35
+ repeat=false
36
+ indicators=[
37
+ {
38
+ trigger: "pending",
39
+ // Again, wrap to ensure no layout jump on change
40
+ content: "<p><span class='loading-wrap'>Loading...</span></p>"
41
+ }
42
+ ]
43
+ }}
44
+ {{/request}}
40
45
</div>
41
46
42
47
<style>
43
- * {
44
- font-size: 18px;
45
- }
48
+ * {
49
+ font-size: 18px;
50
+ }
51
+
52
+ /* 👇 Fixed width wrapper to prevent flickering or shifting */
53
+ .loading-wrap {
54
+ display: inline-block;
55
+ min-width: 90px; /* Adjust this value as needed */
56
+ text-align: center;
57
+ }
46
58
</style>
47
59
48
60
<script>
49
- console.log("this is hmpl example")
50
- </script>
61
+ // Just logging for demo
62
+ console.log("this is hmpl example");
63
+ </script>
You can’t perform that action at this time.
0 commit comments