Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loop04
uni-app
提交
7fcdf51e
U
uni-app
项目概览
loop04
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
7fcdf51e
编写于
4月 02, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): format-log compatible with builtin browser
上级
5b4edae4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
62 deletion
+69
-62
packages/vue-cli-plugin-uni/lib/format-log.js
packages/vue-cli-plugin-uni/lib/format-log.js
+68
-61
packages/vue-cli-plugin-uni/lib/h5/index.js
packages/vue-cli-plugin-uni/lib/h5/index.js
+1
-1
未找到文件。
packages/vue-cli-plugin-uni/lib/format-log.js
浏览文件 @
7fcdf51e
function
typof
(
v
)
{
function
typof
(
v
)
{
var
s
=
Object
.
prototype
.
toString
.
call
(
v
)
var
s
=
Object
.
prototype
.
toString
.
call
(
v
)
return
s
.
substring
(
8
,
s
.
length
-
1
)
return
s
.
substring
(
8
,
s
.
length
-
1
)
}
}
function
isDebugMode
()
{
function
isDebugMode
()
{
/* eslint-disable no-undef */
/* eslint-disable no-undef */
return
typeof
__channelId__
===
'
string
'
&&
__channelId__
return
typeof
__channelId__
===
'
string
'
&&
__channelId__
}
}
export
default
function
formatLog
()
{
export
function
log
(
type
)
{
for
(
var
_len
=
arguments
.
length
,
args
=
new
Array
(
_len
),
_key
=
0
;
_key
<
_len
;
_key
++
)
{
for
(
var
_len
=
arguments
.
length
,
args
=
new
Array
(
_len
>
1
?
_len
-
1
:
0
),
_key
=
1
;
_key
<
_len
;
_key
++
)
{
args
[
_key
]
=
arguments
[
_key
]
args
[
_key
-
1
]
=
arguments
[
_key
]
}
}
var
type
=
args
.
shift
()
console
[
type
].
apply
(
console
,
args
)
}
export
default
function
formatLog
()
{
for
(
var
_len
=
arguments
.
length
,
args
=
new
Array
(
_len
),
_key
=
0
;
_key
<
_len
;
_key
++
)
{
args
[
_key
]
=
arguments
[
_key
]
}
var
type
=
args
.
shift
()
if
(
isDebugMode
())
{
if
(
isDebugMode
())
{
args
.
push
(
args
.
pop
().
replace
(
'
at
'
,
'
uni-app:///
'
))
args
.
push
(
args
.
pop
().
replace
(
'
at
'
,
'
uni-app:///
'
))
return
console
[
type
][
'
apply
'
](
console
,
args
)
return
console
[
type
][
'
apply
'
](
console
,
args
)
}
}
var
msgs
=
args
.
map
(
function
(
v
)
{
var
msgs
=
args
.
map
(
function
(
v
)
{
var
type
=
Object
.
prototype
.
toString
.
call
(
v
).
toLowerCase
()
var
type
=
Object
.
prototype
.
toString
.
call
(
v
).
toLowerCase
()
if
(
type
===
'
[object object]
'
||
type
===
'
[object array]
'
)
{
if
(
type
===
'
[object object]
'
||
type
===
'
[object array]
'
)
{
try
{
try
{
v
=
'
---BEGIN:JSON---
'
+
JSON
.
stringify
(
v
)
+
'
---END:JSON---
'
v
=
'
---BEGIN:JSON---
'
+
JSON
.
stringify
(
v
)
+
'
---END:JSON---
'
}
catch
(
e
)
{
}
catch
(
e
)
{
v
=
'
[object object]
'
v
=
'
[object object]
'
}
}
}
else
{
}
else
{
if
(
v
===
null
)
{
if
(
v
===
null
)
{
v
=
'
---NULL---
'
v
=
'
---NULL---
'
}
else
if
(
v
===
undefined
)
{
}
else
if
(
v
===
undefined
)
{
v
=
'
---UNDEFINED---
'
v
=
'
---UNDEFINED---
'
}
else
{
}
else
{
var
vType
=
typof
(
v
).
toUpperCase
()
var
vType
=
typof
(
v
).
toUpperCase
()
if
(
vType
===
'
NUMBER
'
||
vType
===
'
BOOLEAN
'
)
{
if
(
vType
===
'
NUMBER
'
||
vType
===
'
BOOLEAN
'
)
{
v
=
'
---BEGIN:
'
+
vType
+
'
---
'
+
v
+
'
---END:
'
+
vType
+
'
---
'
v
=
'
---BEGIN:
'
+
vType
+
'
---
'
+
v
+
'
---END:
'
+
vType
+
'
---
'
}
else
{
}
else
{
v
=
String
(
v
)
v
=
String
(
v
)
}
}
}
}
}
}
return
v
return
v
})
})
var
msg
=
''
var
msg
=
''
if
(
msgs
.
length
>
1
)
{
if
(
msgs
.
length
>
1
)
{
var
lastMsg
=
msgs
.
pop
()
var
lastMsg
=
msgs
.
pop
()
msg
=
msgs
.
join
(
'
---COMMA---
'
)
msg
=
msgs
.
join
(
'
---COMMA---
'
)
if
(
lastMsg
.
indexOf
(
'
at
'
)
===
0
)
{
if
(
lastMsg
.
indexOf
(
'
at
'
)
===
0
)
{
msg
+=
lastMsg
msg
+=
lastMsg
}
else
{
}
else
{
msg
+=
'
---COMMA---
'
+
lastMsg
msg
+=
'
---COMMA---
'
+
lastMsg
}
}
}
else
{
}
else
{
msg
=
msgs
[
0
]
msg
=
msgs
[
0
]
}
}
console
[
type
](
msg
)
console
[
type
](
msg
)
}
}
packages/vue-cli-plugin-uni/lib/h5/index.js
浏览文件 @
7fcdf51e
...
@@ -34,7 +34,7 @@ const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/inde
...
@@ -34,7 +34,7 @@ const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/inde
function
getProvides
()
{
function
getProvides
()
{
return
{
return
{
'
__f__
'
:
[
path
.
resolve
(
__dirname
,
'
../format-log.js
'
),
'
default
'
],
'
__f__
'
:
[
path
.
resolve
(
__dirname
,
'
../format-log.js
'
),
'
log
'
],
'
uniCloud
'
:
[
uniCloudPath
,
'
default
'
],
'
uniCloud
'
:
[
uniCloudPath
,
'
default
'
],
'
wx.nextTick
'
:
[
runtimePath
,
'
nextTick
'
],
'
wx.nextTick
'
:
[
runtimePath
,
'
nextTick
'
],
'
Page
'
:
[
runtimePath
,
'
Page
'
],
'
Page
'
:
[
runtimePath
,
'
Page
'
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录