Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
20岁爱吃必胜客
uni-app
提交
7841edf4
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,发现更多精彩内容 >>
提交
7841edf4
编写于
8月 25, 2022
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 字节小程序支持onUploadDouyinVideo生命周期#151113
上级
ba291491
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
379 addition
and
384 deletion
+379
-384
packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js
...vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js
+379
-378
src/core/runtime/wrapper/util.js
src/core/runtime/wrapper/util.js
+0
-6
未找到文件。
packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js
浏览文件 @
7841edf4
...
...
@@ -2230,17 +2230,17 @@ function updateListeners (
/* */
// fixed by xxxxxx (mp properties)
function
extractPropertiesFromVNodeData
(
data
,
Ctor
,
res
,
context
)
{
var
propOptions
=
Ctor
.
options
.
mpOptions
&&
Ctor
.
options
.
mpOptions
.
properties
;
if
(
isUndef
(
propOptions
))
{
return
res
// fixed by xxxxxx (mp properties)
function
extractPropertiesFromVNodeData
(
data
,
Ctor
,
res
,
context
)
{
var
propOptions
=
Ctor
.
options
.
mpOptions
&&
Ctor
.
options
.
mpOptions
.
properties
;
if
(
isUndef
(
propOptions
))
{
return
res
}
var
externalClasses
=
Ctor
.
options
.
mpOptions
.
externalClasses
||
[];
var
externalClasses
=
Ctor
.
options
.
mpOptions
.
externalClasses
||
[];
var
attrs
=
data
.
attrs
;
var
props
=
data
.
props
;
if
(
isDef
(
attrs
)
||
isDef
(
props
))
{
for
(
var
key
in
propOptions
)
{
var
props
=
data
.
props
;
if
(
isDef
(
attrs
)
||
isDef
(
props
))
{
for
(
var
key
in
propOptions
)
{
var
altKey
=
hyphenate
(
key
);
var
result
=
checkProp
(
res
,
props
,
key
,
altKey
,
true
)
||
checkProp
(
res
,
attrs
,
key
,
altKey
,
false
);
...
...
@@ -2253,10 +2253,10 @@ function extractPropertiesFromVNodeData(data, Ctor, res, context) {
)
{
// 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
res
[
key
]
=
context
[
camelize
(
res
[
key
])];
}
}
}
return
res
}
}
}
return
res
}
function
extractPropsFromVNodeData
(
...
...
@@ -5522,138 +5522,138 @@ function type(obj) {
return
Object
.
prototype
.
toString
.
call
(
obj
)
}
/* */
function
flushCallbacks$1
(
vm
)
{
if
(
vm
.
__next_tick_callbacks
&&
vm
.
__next_tick_callbacks
.
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
var
mpInstance
=
vm
.
$scope
;
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
vm
.
_uid
+
'
]:flushCallbacks[
'
+
vm
.
__next_tick_callbacks
.
length
+
'
]
'
);
}
var
copies
=
vm
.
__next_tick_callbacks
.
slice
(
0
);
vm
.
__next_tick_callbacks
.
length
=
0
;
for
(
var
i
=
0
;
i
<
copies
.
length
;
i
++
)
{
copies
[
i
]();
}
}
}
function
hasRenderWatcher
(
vm
)
{
return
queue
.
find
(
function
(
watcher
)
{
return
vm
.
_watcher
===
watcher
;
})
}
function
nextTick$1
(
vm
,
cb
)
{
//1.nextTick 之前 已 setData 且 setData 还未回调完成
//2.nextTick 之前存在 render watcher
/* */
function
flushCallbacks$1
(
vm
)
{
if
(
vm
.
__next_tick_callbacks
&&
vm
.
__next_tick_callbacks
.
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
var
mpInstance
=
vm
.
$scope
;
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
vm
.
_uid
+
'
]:flushCallbacks[
'
+
vm
.
__next_tick_callbacks
.
length
+
'
]
'
);
}
var
copies
=
vm
.
__next_tick_callbacks
.
slice
(
0
);
vm
.
__next_tick_callbacks
.
length
=
0
;
for
(
var
i
=
0
;
i
<
copies
.
length
;
i
++
)
{
copies
[
i
]();
}
}
}
function
hasRenderWatcher
(
vm
)
{
return
queue
.
find
(
function
(
watcher
)
{
return
vm
.
_watcher
===
watcher
;
})
}
function
nextTick$1
(
vm
,
cb
)
{
//1.nextTick 之前 已 setData 且 setData 还未回调完成
//2.nextTick 之前存在 render watcher
if
(
!
vm
.
__next_tick_pending
&&
!
hasRenderWatcher
(
vm
))
{
if
(
process
.
env
.
VUE_APP_DEBUG
){
var
mpInstance
=
vm
.
$scope
;
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
vm
.
_uid
+
'
]:nextVueTick
'
);
}
return
nextTick
(
cb
,
vm
)
}
return
nextTick
(
cb
,
vm
)
}
else
{
if
(
process
.
env
.
VUE_APP_DEBUG
){
var
mpInstance$1
=
vm
.
$scope
;
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance$1
.
is
||
mpInstance$1
.
route
)
+
'
][
'
+
vm
.
_uid
+
'
]:nextMPTick
'
);
}
}
var
_resolve
;
if
(
!
vm
.
__next_tick_callbacks
)
{
vm
.
__next_tick_callbacks
=
[];
}
vm
.
__next_tick_callbacks
.
push
(
function
()
{
if
(
cb
)
{
try
{
cb
.
call
(
vm
);
}
catch
(
e
)
{
handleError
(
e
,
vm
,
'
nextTick
'
);
}
}
else
if
(
_resolve
)
{
_resolve
(
vm
);
}
});
// $flow-disable-line
if
(
!
cb
&&
typeof
Promise
!==
'
undefined
'
)
{
return
new
Promise
(
function
(
resolve
)
{
_resolve
=
resolve
;
})
}
}
/* */
function
cloneWithData
(
vm
)
{
// 确保当前 vm 所有数据被同步
var
ret
=
Object
.
create
(
null
);
var
dataKeys
=
[].
concat
(
Object
.
keys
(
vm
.
_data
||
{}),
Object
.
keys
(
vm
.
_computedWatchers
||
{}));
dataKeys
.
reduce
(
function
(
ret
,
key
)
{
ret
[
key
]
=
vm
[
key
];
return
ret
},
ret
);
// vue-composition-api
var
compositionApiState
=
vm
.
__composition_api_state__
||
vm
.
__secret_vfa_state__
;
var
rawBindings
=
compositionApiState
&&
compositionApiState
.
rawBindings
;
if
(
rawBindings
)
{
Object
.
keys
(
rawBindings
).
forEach
(
function
(
key
)
{
ret
[
key
]
=
vm
[
key
];
});
}
//TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
Object
.
assign
(
ret
,
vm
.
$mp
.
data
||
{});
if
(
Array
.
isArray
(
vm
.
$options
.
behaviors
)
&&
vm
.
$options
.
behaviors
.
indexOf
(
'
uni://form-field
'
)
!==
-
1
)
{
//form-field
ret
[
'
name
'
]
=
vm
.
name
;
ret
[
'
value
'
]
=
vm
.
value
;
}
return
JSON
.
parse
(
JSON
.
stringify
(
ret
))
}
}
var
_resolve
;
if
(
!
vm
.
__next_tick_callbacks
)
{
vm
.
__next_tick_callbacks
=
[];
}
vm
.
__next_tick_callbacks
.
push
(
function
()
{
if
(
cb
)
{
try
{
cb
.
call
(
vm
);
}
catch
(
e
)
{
handleError
(
e
,
vm
,
'
nextTick
'
);
}
}
else
if
(
_resolve
)
{
_resolve
(
vm
);
}
});
// $flow-disable-line
if
(
!
cb
&&
typeof
Promise
!==
'
undefined
'
)
{
return
new
Promise
(
function
(
resolve
)
{
_resolve
=
resolve
;
})
}
}
/* */
function
cloneWithData
(
vm
)
{
// 确保当前 vm 所有数据被同步
var
ret
=
Object
.
create
(
null
);
var
dataKeys
=
[].
concat
(
Object
.
keys
(
vm
.
_data
||
{}),
Object
.
keys
(
vm
.
_computedWatchers
||
{}));
dataKeys
.
reduce
(
function
(
ret
,
key
)
{
ret
[
key
]
=
vm
[
key
];
return
ret
},
ret
);
// vue-composition-api
var
compositionApiState
=
vm
.
__composition_api_state__
||
vm
.
__secret_vfa_state__
;
var
rawBindings
=
compositionApiState
&&
compositionApiState
.
rawBindings
;
if
(
rawBindings
)
{
Object
.
keys
(
rawBindings
).
forEach
(
function
(
key
)
{
ret
[
key
]
=
vm
[
key
];
});
}
//TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
Object
.
assign
(
ret
,
vm
.
$mp
.
data
||
{});
if
(
Array
.
isArray
(
vm
.
$options
.
behaviors
)
&&
vm
.
$options
.
behaviors
.
indexOf
(
'
uni://form-field
'
)
!==
-
1
)
{
//form-field
ret
[
'
name
'
]
=
vm
.
name
;
ret
[
'
value
'
]
=
vm
.
value
;
}
return
JSON
.
parse
(
JSON
.
stringify
(
ret
))
}
var
patch
=
function
(
oldVnode
,
vnode
)
{
var
this
$1
=
this
;
if
(
vnode
===
null
)
{
//destroy
return
}
if
(
this
.
mpType
===
'
page
'
||
this
.
mpType
===
'
component
'
)
{
var
mpInstance
=
this
.
$scope
;
var
data
=
Object
.
create
(
null
);
try
{
data
=
cloneWithData
(
this
);
}
catch
(
err
)
{
console
.
error
(
err
);
}
data
.
__webviewId__
=
mpInstance
.
data
.
__webviewId__
;
var
mpData
=
Object
.
create
(
null
);
Object
.
keys
(
data
).
forEach
(
function
(
key
)
{
//仅同步 data 中有的数据
mpData
[
key
]
=
mpInstance
.
data
[
key
];
});
var
diffData
=
this
.
$shouldDiffData
===
false
?
data
:
diff
(
data
,
mpData
);
if
(
Object
.
keys
(
diffData
).
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
this
.
_uid
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
}
this
.
__next_tick_pending
=
true
;
mpInstance
.
setData
(
diffData
,
function
()
{
this
$1
.
__next_tick_pending
=
false
;
flushCallbacks$1
(
this
$1
);
});
}
else
{
flushCallbacks$1
(
this
);
}
}
if
(
vnode
===
null
)
{
//destroy
return
}
if
(
this
.
mpType
===
'
page
'
||
this
.
mpType
===
'
component
'
)
{
var
mpInstance
=
this
.
$scope
;
var
data
=
Object
.
create
(
null
);
try
{
data
=
cloneWithData
(
this
);
}
catch
(
err
)
{
console
.
error
(
err
);
}
data
.
__webviewId__
=
mpInstance
.
data
.
__webviewId__
;
var
mpData
=
Object
.
create
(
null
);
Object
.
keys
(
data
).
forEach
(
function
(
key
)
{
//仅同步 data 中有的数据
mpData
[
key
]
=
mpInstance
.
data
[
key
];
});
var
diffData
=
this
.
$shouldDiffData
===
false
?
data
:
diff
(
data
,
mpData
);
if
(
Object
.
keys
(
diffData
).
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
log
(
'
[
'
+
(
+
new
Date
)
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
this
.
_uid
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
}
this
.
__next_tick_pending
=
true
;
mpInstance
.
setData
(
diffData
,
function
()
{
this
$1
.
__next_tick_pending
=
false
;
flushCallbacks$1
(
this
$1
);
});
}
else
{
flushCallbacks$1
(
this
);
}
}
};
/* */
...
...
@@ -5794,252 +5794,253 @@ function normalizeStyleBinding (bindingStyle) {
return
bindingStyle
}
/* */
var
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
'
selectAllComponents
'
,
'
selectComponent
'
];
function
getTarget
(
obj
,
path
)
{
var
parts
=
path
.
split
(
'
.
'
);
var
key
=
parts
[
0
];
if
(
key
.
indexOf
(
'
__$n
'
)
===
0
)
{
//number index
key
=
parseInt
(
key
.
replace
(
'
__$n
'
,
''
));
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
]
}
return
getTarget
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
))
}
function
internalMixin
(
Vue
)
{
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
Vue
.
util
.
warn
((
"
Error in
"
+
info
+
"
:
\"
"
+
(
err
.
toString
())
+
"
\"
"
),
vm
);
console
.
error
(
err
);
/* eslint-disable no-undef */
var
app
=
typeof
getApp
===
'
function
'
&&
getApp
();
if
(
app
&&
app
.
onError
)
{
app
.
onError
(
err
);
}
};
var
oldEmit
=
Vue
.
prototype
.
$emit
;
Vue
.
prototype
.
$emit
=
function
(
event
)
{
if
(
this
.
$scope
&&
event
)
{
(
this
.
$scope
[
'
_triggerEvent
'
]
||
this
.
$scope
[
'
triggerEvent
'
]).
call
(
this
.
$scope
,
event
,
{
__args__
:
toArray
(
arguments
,
1
)
});
}
return
oldEmit
.
apply
(
this
,
arguments
)
};
Vue
.
prototype
.
$nextTick
=
function
(
fn
)
{
return
nextTick$1
(
this
,
fn
)
};
MP_METHODS
.
forEach
(
function
(
method
)
{
Vue
.
prototype
[
method
]
=
function
(
args
)
{
if
(
this
.
$scope
&&
this
.
$scope
[
method
])
{
return
this
.
$scope
[
method
](
args
)
}
// mp-alipay
if
(
typeof
my
===
'
undefined
'
)
{
return
}
if
(
method
===
'
createSelectorQuery
'
)
{
/* eslint-disable no-undef */
return
my
.
createSelectorQuery
(
args
)
}
else
if
(
method
===
'
createIntersectionObserver
'
)
{
/* eslint-disable no-undef */
return
my
.
createIntersectionObserver
(
args
)
}
// TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
};
});
Vue
.
prototype
.
__init_provide
=
initProvide
;
Vue
.
prototype
.
__init_injections
=
initInjections
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
var
vm
=
this
;
// #7573 disable dep collection when invoking lifecycle hooks
pushTarget
();
var
handlers
=
vm
.
$options
[
hook
];
var
info
=
hook
+
"
hook
"
;
var
ret
;
if
(
handlers
)
{
for
(
var
i
=
0
,
j
=
handlers
.
length
;
i
<
j
;
i
++
)
{
ret
=
invokeWithErrorHandling
(
handlers
[
i
],
vm
,
args
?
[
args
]
:
null
,
vm
,
info
);
}
}
if
(
vm
.
_hasHookEvent
)
{
vm
.
$emit
(
'
hook:
'
+
hook
,
args
);
}
popTarget
();
return
ret
};
Vue
.
prototype
.
__set_model
=
function
(
target
,
key
,
value
,
modifiers
)
{
if
(
Array
.
isArray
(
modifiers
))
{
if
(
modifiers
.
indexOf
(
'
trim
'
)
!==
-
1
)
{
value
=
value
.
trim
();
}
if
(
modifiers
.
indexOf
(
'
number
'
)
!==
-
1
)
{
value
=
this
.
_n
(
value
);
}
}
if
(
!
target
)
{
target
=
this
;
}
// 解决动态属性添加
Vue
.
set
(
target
,
key
,
value
);
};
Vue
.
prototype
.
__set_sync
=
function
(
target
,
key
,
value
)
{
if
(
!
target
)
{
target
=
this
;
}
// 解决动态属性添加
Vue
.
set
(
target
,
key
,
value
);
};
Vue
.
prototype
.
__get_orig
=
function
(
item
)
{
if
(
isPlainObject
(
item
))
{
return
item
[
'
$orig
'
]
||
item
}
return
item
};
Vue
.
prototype
.
__get_value
=
function
(
dataPath
,
target
)
{
return
getTarget
(
target
||
this
,
dataPath
)
};
Vue
.
prototype
.
__get_class
=
function
(
dynamicClass
,
staticClass
)
{
return
renderClass
(
staticClass
,
dynamicClass
)
};
Vue
.
prototype
.
__get_style
=
function
(
dynamicStyle
,
staticStyle
)
{
if
(
!
dynamicStyle
&&
!
staticStyle
)
{
return
''
}
var
dynamicStyleObj
=
normalizeStyleBinding
(
dynamicStyle
);
var
styleObj
=
staticStyle
?
extend
(
staticStyle
,
dynamicStyleObj
)
:
dynamicStyleObj
;
return
Object
.
keys
(
styleObj
).
map
(
function
(
name
)
{
return
((
hyphenate
(
name
))
+
"
:
"
+
(
styleObj
[
name
]));
}).
join
(
'
;
'
)
};
Vue
.
prototype
.
__map
=
function
(
val
,
iteratee
)
{
//TODO 暂不考虑 string
var
ret
,
i
,
l
,
keys
,
key
;
if
(
Array
.
isArray
(
val
))
{
ret
=
new
Array
(
val
.
length
);
for
(
i
=
0
,
l
=
val
.
length
;
i
<
l
;
i
++
)
{
ret
[
i
]
=
iteratee
(
val
[
i
],
i
);
}
return
ret
}
else
if
(
isObject
(
val
))
{
keys
=
Object
.
keys
(
val
);
ret
=
Object
.
create
(
null
);
for
(
i
=
0
,
l
=
keys
.
length
;
i
<
l
;
i
++
)
{
key
=
keys
[
i
];
ret
[
key
]
=
iteratee
(
val
[
key
],
key
,
i
);
}
return
ret
}
else
if
(
typeof
val
===
'
number
'
)
{
ret
=
new
Array
(
val
);
for
(
i
=
0
,
l
=
val
;
i
<
l
;
i
++
)
{
// 第一个参数暂时仍和小程序一致
ret
[
i
]
=
iteratee
(
i
,
i
);
}
return
ret
}
return
[]
};
}
/* */
var
LIFECYCLE_HOOKS$1
=
[
//App
'
onLaunch
'
,
'
onShow
'
,
'
onHide
'
,
'
onUniNViewMessage
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onError
'
,
'
onUnhandledRejection
'
,
//Page
'
onInit
'
,
'
onLoad
'
,
// 'onShow',
'
onReady
'
,
// 'onHide',
'
onUnload
'
,
'
onPullDownRefresh
'
,
'
onReachBottom
'
,
'
onTabItemTap
'
,
'
onAddToFavorites
'
,
'
onShareTimeline
'
,
'
onShareAppMessage
'
,
'
onResize
'
,
'
onPageScroll
'
,
'
onNavigationBarButtonTap
'
,
'
onBackPress
'
,
'
onNavigationBarSearchInputChanged
'
,
'
onNavigationBarSearchInputConfirmed
'
,
'
onNavigationBarSearchInputClicked
'
,
//Component
// 'onReady', // 兼容旧版本,应该移除该事件
'
onPageShow
'
,
'
onPageHide
'
,
'
onPageResize
'
];
function
lifecycleMixin$1
(
Vue
)
{
//fixed vue-class-component
var
oldExtend
=
Vue
.
extend
;
Vue
.
extend
=
function
(
extendOptions
)
{
extendOptions
=
extendOptions
||
{};
var
methods
=
extendOptions
.
methods
;
if
(
methods
)
{
Object
.
keys
(
methods
).
forEach
(
function
(
methodName
)
{
if
(
LIFECYCLE_HOOKS$1
.
indexOf
(
methodName
)
!==-
1
)
{
extendOptions
[
methodName
]
=
methods
[
methodName
];
delete
methods
[
methodName
];
}
});
}
return
oldExtend
.
call
(
this
,
extendOptions
)
};
var
strategies
=
Vue
.
config
.
optionMergeStrategies
;
var
mergeHook
=
strategies
.
created
;
LIFECYCLE_HOOKS$1
.
forEach
(
function
(
hook
)
{
strategies
[
hook
]
=
mergeHook
;
});
Vue
.
prototype
.
__lifecycle_hooks__
=
LIFECYCLE_HOOKS$1
;
}
/* */
// install platform patch function
Vue
.
prototype
.
__patch__
=
patch
;
// public mount method
Vue
.
prototype
.
$mount
=
function
(
el
,
hydrating
)
{
return
mountComponent$1
(
this
,
el
,
hydrating
)
};
lifecycleMixin$1
(
Vue
);
/* */
var
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
'
selectAllComponents
'
,
'
selectComponent
'
];
function
getTarget
(
obj
,
path
)
{
var
parts
=
path
.
split
(
'
.
'
);
var
key
=
parts
[
0
];
if
(
key
.
indexOf
(
'
__$n
'
)
===
0
)
{
//number index
key
=
parseInt
(
key
.
replace
(
'
__$n
'
,
''
));
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
]
}
return
getTarget
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
))
}
function
internalMixin
(
Vue
)
{
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
Vue
.
util
.
warn
((
"
Error in
"
+
info
+
"
:
\"
"
+
(
err
.
toString
())
+
"
\"
"
),
vm
);
console
.
error
(
err
);
/* eslint-disable no-undef */
var
app
=
typeof
getApp
===
'
function
'
&&
getApp
();
if
(
app
&&
app
.
onError
)
{
app
.
onError
(
err
);
}
};
var
oldEmit
=
Vue
.
prototype
.
$emit
;
Vue
.
prototype
.
$emit
=
function
(
event
)
{
if
(
this
.
$scope
&&
event
)
{
(
this
.
$scope
[
'
_triggerEvent
'
]
||
this
.
$scope
[
'
triggerEvent
'
]).
call
(
this
.
$scope
,
event
,
{
__args__
:
toArray
(
arguments
,
1
)
});
}
return
oldEmit
.
apply
(
this
,
arguments
)
};
Vue
.
prototype
.
$nextTick
=
function
(
fn
)
{
return
nextTick$1
(
this
,
fn
)
};
MP_METHODS
.
forEach
(
function
(
method
)
{
Vue
.
prototype
[
method
]
=
function
(
args
)
{
if
(
this
.
$scope
&&
this
.
$scope
[
method
])
{
return
this
.
$scope
[
method
](
args
)
}
// mp-alipay
if
(
typeof
my
===
'
undefined
'
)
{
return
}
if
(
method
===
'
createSelectorQuery
'
)
{
/* eslint-disable no-undef */
return
my
.
createSelectorQuery
(
args
)
}
else
if
(
method
===
'
createIntersectionObserver
'
)
{
/* eslint-disable no-undef */
return
my
.
createIntersectionObserver
(
args
)
}
// TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
};
});
Vue
.
prototype
.
__init_provide
=
initProvide
;
Vue
.
prototype
.
__init_injections
=
initInjections
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
var
vm
=
this
;
// #7573 disable dep collection when invoking lifecycle hooks
pushTarget
();
var
handlers
=
vm
.
$options
[
hook
];
var
info
=
hook
+
"
hook
"
;
var
ret
;
if
(
handlers
)
{
for
(
var
i
=
0
,
j
=
handlers
.
length
;
i
<
j
;
i
++
)
{
ret
=
invokeWithErrorHandling
(
handlers
[
i
],
vm
,
args
?
[
args
]
:
null
,
vm
,
info
);
}
}
if
(
vm
.
_hasHookEvent
)
{
vm
.
$emit
(
'
hook:
'
+
hook
,
args
);
}
popTarget
();
return
ret
};
Vue
.
prototype
.
__set_model
=
function
(
target
,
key
,
value
,
modifiers
)
{
if
(
Array
.
isArray
(
modifiers
))
{
if
(
modifiers
.
indexOf
(
'
trim
'
)
!==
-
1
)
{
value
=
value
.
trim
();
}
if
(
modifiers
.
indexOf
(
'
number
'
)
!==
-
1
)
{
value
=
this
.
_n
(
value
);
}
}
if
(
!
target
)
{
target
=
this
;
}
// 解决动态属性添加
Vue
.
set
(
target
,
key
,
value
);
};
Vue
.
prototype
.
__set_sync
=
function
(
target
,
key
,
value
)
{
if
(
!
target
)
{
target
=
this
;
}
// 解决动态属性添加
Vue
.
set
(
target
,
key
,
value
);
};
Vue
.
prototype
.
__get_orig
=
function
(
item
)
{
if
(
isPlainObject
(
item
))
{
return
item
[
'
$orig
'
]
||
item
}
return
item
};
Vue
.
prototype
.
__get_value
=
function
(
dataPath
,
target
)
{
return
getTarget
(
target
||
this
,
dataPath
)
};
Vue
.
prototype
.
__get_class
=
function
(
dynamicClass
,
staticClass
)
{
return
renderClass
(
staticClass
,
dynamicClass
)
};
Vue
.
prototype
.
__get_style
=
function
(
dynamicStyle
,
staticStyle
)
{
if
(
!
dynamicStyle
&&
!
staticStyle
)
{
return
''
}
var
dynamicStyleObj
=
normalizeStyleBinding
(
dynamicStyle
);
var
styleObj
=
staticStyle
?
extend
(
staticStyle
,
dynamicStyleObj
)
:
dynamicStyleObj
;
return
Object
.
keys
(
styleObj
).
map
(
function
(
name
)
{
return
((
hyphenate
(
name
))
+
"
:
"
+
(
styleObj
[
name
]));
}).
join
(
'
;
'
)
};
Vue
.
prototype
.
__map
=
function
(
val
,
iteratee
)
{
//TODO 暂不考虑 string
var
ret
,
i
,
l
,
keys
,
key
;
if
(
Array
.
isArray
(
val
))
{
ret
=
new
Array
(
val
.
length
);
for
(
i
=
0
,
l
=
val
.
length
;
i
<
l
;
i
++
)
{
ret
[
i
]
=
iteratee
(
val
[
i
],
i
);
}
return
ret
}
else
if
(
isObject
(
val
))
{
keys
=
Object
.
keys
(
val
);
ret
=
Object
.
create
(
null
);
for
(
i
=
0
,
l
=
keys
.
length
;
i
<
l
;
i
++
)
{
key
=
keys
[
i
];
ret
[
key
]
=
iteratee
(
val
[
key
],
key
,
i
);
}
return
ret
}
else
if
(
typeof
val
===
'
number
'
)
{
ret
=
new
Array
(
val
);
for
(
i
=
0
,
l
=
val
;
i
<
l
;
i
++
)
{
// 第一个参数暂时仍和小程序一致
ret
[
i
]
=
iteratee
(
i
,
i
);
}
return
ret
}
return
[]
};
}
/* */
var
LIFECYCLE_HOOKS$1
=
[
//App
'
onLaunch
'
,
'
onShow
'
,
'
onHide
'
,
'
onUniNViewMessage
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onError
'
,
'
onUnhandledRejection
'
,
//Page
'
onInit
'
,
'
onLoad
'
,
// 'onShow',
'
onReady
'
,
// 'onHide',
'
onUnload
'
,
'
onPullDownRefresh
'
,
'
onReachBottom
'
,
'
onTabItemTap
'
,
'
onAddToFavorites
'
,
'
onShareTimeline
'
,
'
onShareAppMessage
'
,
'
onResize
'
,
'
onPageScroll
'
,
'
onNavigationBarButtonTap
'
,
'
onBackPress
'
,
'
onNavigationBarSearchInputChanged
'
,
'
onNavigationBarSearchInputConfirmed
'
,
'
onNavigationBarSearchInputClicked
'
,
//Component
// 'onReady', // 兼容旧版本,应该移除该事件
'
onPageShow
'
,
'
onPageHide
'
,
'
onPageResize
'
,
'
onUploadDouyinVideo
'
];
function
lifecycleMixin$1
(
Vue
)
{
//fixed vue-class-component
var
oldExtend
=
Vue
.
extend
;
Vue
.
extend
=
function
(
extendOptions
)
{
extendOptions
=
extendOptions
||
{};
var
methods
=
extendOptions
.
methods
;
if
(
methods
)
{
Object
.
keys
(
methods
).
forEach
(
function
(
methodName
)
{
if
(
LIFECYCLE_HOOKS$1
.
indexOf
(
methodName
)
!==-
1
)
{
extendOptions
[
methodName
]
=
methods
[
methodName
];
delete
methods
[
methodName
];
}
});
}
return
oldExtend
.
call
(
this
,
extendOptions
)
};
var
strategies
=
Vue
.
config
.
optionMergeStrategies
;
var
mergeHook
=
strategies
.
created
;
LIFECYCLE_HOOKS$1
.
forEach
(
function
(
hook
)
{
strategies
[
hook
]
=
mergeHook
;
});
Vue
.
prototype
.
__lifecycle_hooks__
=
LIFECYCLE_HOOKS$1
;
}
/* */
// install platform patch function
Vue
.
prototype
.
__patch__
=
patch
;
// public mount method
Vue
.
prototype
.
$mount
=
function
(
el
,
hydrating
)
{
return
mountComponent$1
(
this
,
el
,
hydrating
)
};
lifecycleMixin$1
(
Vue
);
internalMixin
(
Vue
);
/* */
...
...
src/core/runtime/wrapper/util.js
浏览文件 @
7841edf4
...
...
@@ -87,12 +87,6 @@ function findHooks (vueOptions, hooks = []) {
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
if
(
(
__PLATFORM__
===
'
mp-toutiao
'
||
__PLATFORM__
===
'
mp-lark
'
)
&&
hook
===
'
onError
'
)
{
return
getApp
().
$vm
.
$callHook
(
hook
,
args
)
}
return
this
.
$vm
&&
this
.
$vm
.
__call_hook
(
hook
,
args
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录