File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
1
package conf
2
2
3
3
import (
4
- stdtpl "html/template"
5
4
"net/http"
6
- "strings"
7
5
8
6
"github.com/zrcoder/amisgo/internal/conf"
9
7
"github.com/zrcoder/amisgo/internal/template"
31
29
type Config struct {
32
30
Title string
33
31
Icon string
34
- CustomCSS stdtpl. CSS
35
- CustomJS stdtpl. JS
32
+ CustomCSS [] string
33
+ CustomJS [] string
36
34
LocalSdkFS http.FileSystem
37
35
* template.Templ
38
36
}
@@ -108,14 +106,14 @@ func WithIcon(icon string) Option {
108
106
// WithCustomCSS sets the custom CSS URL.
109
107
func WithCustomCSS (customCSS ... string ) Option {
110
108
return func (c * Config ) {
111
- c .CustomCSS = stdtpl . CSS ( strings . Join ( customCSS , " \n " ))
109
+ c .CustomCSS = customCSS
112
110
}
113
111
}
114
112
115
113
// WithCustomJS sets the custom JavaScript URL.
116
114
func WithCustomJS (customJS ... string ) Option {
117
115
return func (c * Config ) {
118
- c .CustomJS = stdtpl . JS ( strings . Join ( customJS , " \n " ))
116
+ c .CustomJS = customJS
119
117
}
120
118
}
121
119
Original file line number Diff line number Diff line change 27
27
<link rel="stylesheet" href="{{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/helper.min.css" />
28
28
<link rel="stylesheet" href="{{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/iconfont.min.css" />
29
29
{{ end }}
30
+
31
+ {{ range .CustomCSS }}
32
+ <link rel="stylesheet" href="{{.}}" />
33
+ {{ end }}
34
+
35
+ {{ range .CustomJS }}
36
+ <script src="{{.}}"></script>
37
+ {{ end }}
30
38
31
39
<style>
32
40
html,
38
46
margin: 0;
39
47
padding: 0;
40
48
}
41
- {{ .CustomCSS }}
42
49
</style>
43
50
</head>
44
51
<body>
48
55
{{ else }}
49
56
<script src="{{ .AmisBaseURL }}@{{ .AmisVersion }}/sdk/sdk.min.js"></script>
50
57
{{ end }}
51
- {{ if .CustomJS }}
52
- <script type="text/javascript">
53
- {{ .CustomJS }}
54
- </script>
55
- {{ end }}
56
58
<script type="text/javascript">
57
59
(function () {
58
60
let amis = amisRequire('amis/embed');
You can’t perform that action at this time.
0 commit comments