提交 e22605f3 编写于 作者: fxy060608's avatar fxy060608

chore: cdn

上级 a5a45741
......@@ -17,7 +17,26 @@ function getShadowCss () {
if (process.env.UNI_PLATFORM === 'h5') {
tagName = 'body'
}
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}`
const cdn = getShadowCdn()
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}`
}
const cdns = {
'mp-weixin': 1,
'mp-alipay': 2,
'mp-baidu': 3,
'mp-toutiao': 4,
'mp-qq': 5,
'mp-360': 7,
'mp-dingtalk': 8,
'mp-kuaishou': 9,
'mp-lark': 10,
'quickapp-webview-huawei': 200,
'quickapp-webview-union': 201
}
function getShadowCdn () {
const index = cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
return `https://cdn${index}.dcloud.net.cn`
}
// 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在
......@@ -34,7 +53,8 @@ module.exports = {
normalizeNodeModules,
isInHBuilderX,
isInHBuilderXAlpha,
runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '', 'weapp-tools')),
runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '',
'weapp-tools')),
getFlexDirection (json) {
let flexDir = 'column'
if (json && json.nvue && json.nvue['flex-direction']) {
......@@ -129,7 +149,7 @@ module.exports = {
if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
tagName = 'image'
}
return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
return `<${tagName} src="${getShadowCdn()}/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
},
getPlatformScss () {
return SCSS
......@@ -141,7 +161,9 @@ module.exports = {
return {
sourceType: 'module',
plugins: [
['pipelineOperator', { proposal: 'minimal' }],
['pipelineOperator', {
proposal: 'minimal'
}],
'doExpressions',
'optionalChaining',
'typescript',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册