Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
20岁爱吃必胜客
uni-app
提交
ac42e79d
U
uni-app
项目概览
20岁爱吃必胜客
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ac42e79d
编写于
4月 21, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(nvue): move polyfill to top
上级
7a2d250f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
29 deletion
+27
-29
.eslintignore
.eslintignore
+1
-0
packages/uni-cli-shared/lib/uni-polyfill.js
packages/uni-cli-shared/lib/uni-polyfill.js
+17
-0
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
+1
-0
packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js
...in-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js
+1
-15
packages/webpack-uni-pages-loader/lib/platforms/app-plus/define-pages.js
...k-uni-pages-loader/lib/platforms/app-plus/define-pages.js
+7
-14
未找到文件。
.eslintignore
浏览文件 @
ac42e79d
...
...
@@ -35,3 +35,4 @@ packages/uni-stat
node_modules
automator.js
uni.automator.js
uni-polyfill.js
packages/uni-cli-shared/lib/uni-polyfill.js
0 → 100644
浏览文件 @
ac42e79d
if
(
typeof
Promise
!==
'
undefined
'
&&
!
Promise
.
prototype
.
finally
)
{
Promise
.
prototype
.
finally
=
function
(
callback
)
{
var
promise
=
this
.
constructor
return
this
.
then
(
function
(
value
)
{
return
promise
.
resolve
(
callback
()).
then
(
function
()
{
return
value
})
},
function
(
reason
)
{
return
promise
.
resolve
(
callback
()).
then
(
function
()
{
throw
reason
})
})
}
}
if
(
uni
.
base64ToArrayBuffer
)
{
ArrayBuffer
=
uni
.
base64ToArrayBuffer
(
''
).
constructor
}
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
浏览文件 @
ac42e79d
...
...
@@ -316,6 +316,7 @@ module.exports = function () {
extensions
:
[
'
.js
'
,
'
.nvue
'
,
'
.vue
'
,
'
.json
'
],
alias
:
{
'
@
'
:
process
.
env
.
UNI_INPUT_DIR
,
'
uni-polyfill
'
:
require
.
resolve
(
'
@dcloudio/uni-cli-shared/lib/uni-polyfill.js
'
),
'
uni-pages
'
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
pages.json
'
),
'
uni-app-style
'
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
getNVueMainEntry
())
+
'
?
'
+
JSON
.
stringify
({
type
:
'
appStyle
'
...
...
packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js
浏览文件 @
ac42e79d
...
...
@@ -59,22 +59,8 @@ module.exports = function (content, map) {
return
`
${
statCode
}
import 'uni-app-style'
import 'uni-polyfill'
import App from './
${
normalizePath
(
params
.
page
)}
.nvue?mpType=page'
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
var promise = this.constructor
return this.then(function(value) {
return promise.resolve(callback()).then(function() {
return value
})
}, function(reason) {
return promise.resolve(callback()).then(function() {
throw reason
})
})
}
}
ArrayBuffer = uni.base64ToArrayBuffer('').constructor
App.mpType = 'page'
App.route = '
${
params
.
page
}
'
App.el = '#root'
...
...
packages/webpack-uni-pages-loader/lib/platforms/app-plus/define-pages.js
浏览文件 @
ac42e79d
const
fs
=
require
(
'
fs
'
)
function
generatePageCode
(
pages
,
pageOptions
)
{
return
pages
.
map
(
pagePath
=>
{
if
(
pageOptions
[
pagePath
].
nvue
)
{
...
...
@@ -11,24 +13,15 @@ function generateUniConfig (appJson, isAppView) {
return
isAppView
?
`window.__uniConfig =
${
JSON
.
stringify
({
window
:
appJson
.
window
},
null
)}
;`
:
''
}
function
generatePolyfill
()
{
return
fs
.
readFileSync
(
require
.
resolve
(
'
@dcloudio/uni-cli-shared/lib/uni-polyfill.js
'
),
{
encoding
:
'
utf8
'
})
}
module
.
exports
=
function
definePages
(
appJson
,
isAppView
)
{
return
{
name
:
'
define-pages.js
'
,
content
:
`
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
}
if(uni.base64ToArrayBuffer){
ArrayBuffer = uni.base64ToArrayBuffer('').constructor
}
${
generatePolyfill
()}
${
generateUniConfig
(
appJson
,
isAppView
)}
if(uni.restoreGlobal){
uni.restoreGlobal(weex,plus,setTimeout,clearTimeout,setInterval,clearInterval)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录