forked from dcloudio/uni-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
1,003 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
function getTemplatePath(template) { | ||
if (template) { | ||
return path.resolve(process.env.UNI_INPUT_DIR, template) | ||
} | ||
return path.resolve(process.env.UNI_CLI_CONTEXT, 'public/index.html') | ||
} | ||
|
||
function transform(content) { | ||
if (process.env.NODE_ENV === 'production') { | ||
return content + // shadow | ||
`body::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)}}` | ||
} | ||
return content | ||
} | ||
|
||
function getIndexCssPath(assetsDir, template) { | ||
const VUE_APP_INDEX_CSS_HASH = process.env.VUE_APP_INDEX_CSS_HASH | ||
if (VUE_APP_INDEX_CSS_HASH) { | ||
try { | ||
const templateContent = fs.readFileSync(getTemplatePath(template)) | ||
if (/\bVUE_APP_INDEX_CSS_HASH\b/.test(templateContent)) { | ||
return path.join(assetsDir, `[name].${VUE_APP_INDEX_CSS_HASH}.[ext]`) | ||
} | ||
} catch (e) {} | ||
} | ||
return assetsDir | ||
} | ||
|
||
module.exports = { | ||
options: { | ||
cssVars: { | ||
'--status-bar-height': '0px' | ||
}, | ||
filterTag: 'wxs', | ||
vue: '@dcloudio/vue-cli-plugin-uni/packages/h5-vue' | ||
}, | ||
copyWebpackOptions(platformOptions, vueOptions) { | ||
return [{ | ||
from: require.resolve('@dcloudio/uni-h5/dist/index.css'), | ||
to: getIndexCssPath(vueOptions.assetsDir, platformOptions.template), | ||
transform | ||
}, | ||
'hybrid/html' | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const COMPONENTS_DIR_NAME = 'wxcomponents' | ||
|
||
function getComponentsCopyOption () { | ||
if (process.env.UNI_OUTPUT_TMP_DIR) { // TODO v3不需要,即将废弃 | ||
const componentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME) | ||
if (fs.existsSync(componentsDir)) { | ||
return { | ||
from: componentsDir, | ||
to: COMPONENTS_DIR_NAME, | ||
ignore: ['**/*.vue', '**/*.css'] | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports = { | ||
options: { | ||
extnames: { // TODO v3不需要此配置 | ||
style: '.wxss', | ||
template: '.wxml', | ||
filter: '.wxs' | ||
}, | ||
filterTag: 'wxs' | ||
}, | ||
copyWebpackOptions (platformOptions, vueOptions) { | ||
const copyOptions = [] | ||
const componentsCopyOption = getComponentsCopyOption() | ||
if (componentsCopyOption) { | ||
copyOptions.push(componentsCopyOption) | ||
} | ||
copyOptions.push('hybrid/html') | ||
if (process.env.UNI_USING_V3) { // TODO 将仅保留v3逻辑 | ||
copyOptions.push(path.resolve(__dirname, '../dist/view.css')) | ||
copyOptions.push(path.resolve(__dirname, '../dist/view.umd.min.js')) | ||
// TODO 后续common与v3目录应该合并 | ||
copyOptions.push(path.resolve(__dirname, '../template/common')) | ||
copyOptions.push(path.resolve(__dirname, '../template/v3')) | ||
} | ||
return copyOptions | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
{ | ||
"name": "@dcloudio/uni-app-plus", | ||
"version": "2.0.0-alpha-26420200309002", | ||
"description": "uni-app app-plus", | ||
"main": "dist/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dcloudio/uni-app.git", | ||
"directory": "packages/uni-app-plus" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "fxy060608", | ||
"license": "Apache-2.0", | ||
"gitHead": "84e9cb1ca1898054d161f1514efadd1ab24fd804" | ||
{ | ||
"name": "@dcloudio/uni-app-plus", | ||
"version": "2.0.0-alpha-26420200309002", | ||
"description": "uni-app app-plus", | ||
"main": "dist/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dcloudio/uni-app.git", | ||
"directory": "packages/uni-app-plus" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "fxy060608", | ||
"license": "Apache-2.0", | ||
"uni-app": { | ||
"name": "app-plus", | ||
"title": "APP-PLUS" | ||
}, | ||
"gitHead": "84e9cb1ca1898054d161f1514efadd1ab24fd804" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/uni-app-plus/template/common/__uniappchooselocation.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<script> | ||
var __UniViewStartTime__ = Date.now(); | ||
document.addEventListener('DOMContentLoaded', function() { | ||
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px' | ||
}) | ||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || | ||
CSS.supports('top: constant(a)')) | ||
document.write( | ||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + | ||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') | ||
</script> | ||
<title>View</title> | ||
<link rel="stylesheet" href="view.css" /> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script src="__uniappes6.js"></script> | ||
<script src="view.umd.min.js"></script> | ||
<script src="app-view.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.