-
-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathIconConfig.js
More file actions
33 lines (29 loc) · 959 Bytes
/
Copy pathIconConfig.js
File metadata and controls
33 lines (29 loc) · 959 Bytes
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
const webIconFontPath = 'static/font/iconfont.ttf';
const androidIconFontPath = 'local:///font/iconfont.ttf';
const iosIconFontPath = 'local:///font/iconfont.ttf';
export function getIonFontPath(abs) {
if (WXEnvironment.platform === 'Web') {
return abs + webIconFontPath
} else if (WXEnvironment.platform.toLowerCase() === 'android') {
return androidIconFontPath
} else {
return iosIconFontPath
}
}
export function addIconFontSupport(dom, abs) {
if(dom) {
dom.addRule('fontFace', {
'fontFamily': "wxcIconFont",
'src': `url('${getIonFontPath(abs)}')`
});
}
}
export function getImagePath(name, type = '', abs = '../../') {
if (WXEnvironment.platform === 'Web') {
return `${abs}static/img/${name}${type}`
} else if (WXEnvironment.platform === 'android') {
return `local:///${name}`;
} else {
return `local:///${name}${type}`;
}
}