Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
4a9ce30a
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4a9ce30a
编写于
9月 18, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: merge
上级
415b832d
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
17429 addition
and
19465 deletion
+17429
-19465
packages/uni-h5-vue/dist/vue.runtime.esm.js
packages/uni-h5-vue/dist/vue.runtime.esm.js
+8592
-9599
packages/uni-h5-vue/lib/vue.runtime.esm.js
packages/uni-h5-vue/lib/vue.runtime.esm.js
+8601
-9752
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+118
-57
packages/uni-mp-vue/lib/vue.runtime.esm.js
packages/uni-mp-vue/lib/vue.runtime.esm.js
+118
-57
未找到文件。
packages/uni-h5-vue/dist/vue.runtime.esm.js
浏览文件 @
4a9ce30a
此差异已折叠。
点击以展开。
packages/uni-h5-vue/lib/vue.runtime.esm.js
浏览文件 @
4a9ce30a
此差异已折叠。
点击以展开。
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
4a9ce30a
import
{
isSymbol
,
extend
,
is
Object
,
toRawType
,
def
,
isArray
,
isString
,
isFunction
,
isPromise
,
capitalize
,
remove
,
EMPTY_OBJ
,
NOOP
,
isGloballyWhitelisted
,
isIntegerKey
,
hasOwn
,
hasChanged
,
NO
,
invokeArrayFns
,
makeMap
,
hyphenate
,
isReservedProp
,
camelize
,
EMPTY_ARR
,
toTypeString
,
isOn
}
from
'
@vue/shared
'
;
import
{
isSymbol
,
extend
,
is
Map
,
isObject
,
toRawType
,
def
,
isArray
,
isString
,
isFunction
,
isPromise
,
capitalize
,
remove
,
EMPTY_OBJ
,
NOOP
,
isGloballyWhitelisted
,
isIntegerKey
,
hasOwn
,
hasChanged
,
NO
,
invokeArrayFns
,
isSet
,
makeMap
,
hyphenate
,
isReservedProp
,
camelize
,
EMPTY_ARR
,
toTypeString
,
isOn
}
from
'
@vue/shared
'
;
export
{
camelize
}
from
'
@vue/shared
'
;
import
{
isCustomElement
}
from
'
@dcloudio/uni-shared
'
;
...
...
@@ -116,7 +116,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
const
add
=
(
effectsToAdd
)
=>
{
if
(
effectsToAdd
)
{
effectsToAdd
.
forEach
(
effect
=>
{
if
(
effect
!==
activeEffect
)
{
if
(
effect
!==
activeEffect
||
effect
.
options
.
allowRecurse
)
{
effects
.
add
(
effect
);
}
});
...
...
@@ -140,15 +140,32 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
add
(
depsMap
.
get
(
key
));
}
// also run for iteration key on ADD | DELETE | Map.SET
const
shouldTriggerIteration
=
(
type
===
"
add
"
/* ADD */
&&
(
!
isArray
(
target
)
||
isIntegerKey
(
key
)))
||
(
type
===
"
delete
"
/* DELETE */
&&
!
isArray
(
target
));
if
(
shouldTriggerIteration
||
(
type
===
"
set
"
/* SET */
&&
target
instanceof
Map
))
{
add
(
depsMap
.
get
(
isArray
(
target
)
?
'
length
'
:
ITERATE_KEY
));
}
if
(
shouldTriggerIteration
&&
target
instanceof
Map
)
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
switch
(
type
)
{
case
"
add
"
/* ADD */
:
if
(
!
isArray
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
}
}
else
if
(
isIntegerKey
(
key
))
{
// new index added to array -> length changes
add
(
depsMap
.
get
(
'
length
'
));
}
break
;
case
"
delete
"
/* DELETE */
:
if
(
!
isArray
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
}
}
break
;
case
"
set
"
/* SET */
:
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
}
break
;
}
}
const
run
=
(
effect
)
=>
{
...
...
@@ -182,22 +199,32 @@ const readonlyGet = /*#__PURE__*/ createGetter(true);
const
shallowReadonlyGet
=
/*#__PURE__*/
createGetter
(
true
,
true
);
const
arrayInstrumentations
=
{};
[
'
includes
'
,
'
indexOf
'
,
'
lastIndexOf
'
].
forEach
(
key
=>
{
const
method
=
Array
.
prototype
[
key
];
arrayInstrumentations
[
key
]
=
function
(...
args
)
{
const
arr
=
toRaw
(
this
);
for
(
let
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
track
(
arr
,
"
get
"
/* GET */
,
i
+
''
);
}
// we run the method using the original args first (which may be reactive)
const
res
=
arr
[
key
](...
args
);
const
res
=
method
.
apply
(
arr
,
args
);
if
(
res
===
-
1
||
res
===
false
)
{
// if that didn't work, run it again using raw values.
return
arr
[
key
](...
args
.
map
(
toRaw
));
return
method
.
apply
(
arr
,
args
.
map
(
toRaw
));
}
else
{
return
res
;
}
};
});
[
'
push
'
,
'
pop
'
,
'
shift
'
,
'
unshift
'
,
'
splice
'
].
forEach
(
key
=>
{
const
method
=
Array
.
prototype
[
key
];
arrayInstrumentations
[
key
]
=
function
(...
args
)
{
pauseTracking
();
const
res
=
method
.
apply
(
this
,
args
);
enableTracking
();
return
res
;
};
});
function
createGetter
(
isReadonly
=
false
,
shallow
=
false
)
{
return
function
get
(
target
,
key
,
receiver
)
{
if
(
key
===
"
__v_isReactive
"
/* IS_REACTIVE */
)
{
...
...
@@ -367,7 +394,7 @@ function add(value) {
const
target
=
toRaw
(
this
);
const
proto
=
getProto
(
target
);
const
hadKey
=
proto
.
has
.
call
(
target
,
value
);
const
result
=
proto
.
add
.
call
(
target
,
value
);
const
result
=
target
.
add
(
value
);
if
(
!
hadKey
)
{
trigger
(
target
,
"
add
"
/* ADD */
,
value
,
value
);
}
...
...
@@ -376,7 +403,7 @@ function add(value) {
function
set
$1
(
key
,
value
)
{
value
=
toRaw
(
value
);
const
target
=
toRaw
(
this
);
const
{
has
,
get
,
set
}
=
getProto
(
target
);
const
{
has
,
get
}
=
getProto
(
target
);
let
hadKey
=
has
.
call
(
target
,
key
);
if
(
!
hadKey
)
{
key
=
toRaw
(
key
);
...
...
@@ -386,7 +413,7 @@ function set$1(key, value) {
checkIdentityKeys
(
target
,
has
,
key
);
}
const
oldValue
=
get
.
call
(
target
,
key
);
const
result
=
set
.
call
(
target
,
key
,
value
);
const
result
=
target
.
set
(
key
,
value
);
if
(
!
hadKey
)
{
trigger
(
target
,
"
add
"
/* ADD */
,
key
,
value
);
}
...
...
@@ -397,7 +424,7 @@ function set$1(key, value) {
}
function
deleteEntry
(
key
)
{
const
target
=
toRaw
(
this
);
const
{
has
,
get
,
delete
:
del
}
=
getProto
(
target
);
const
{
has
,
get
}
=
getProto
(
target
);
let
hadKey
=
has
.
call
(
target
,
key
);
if
(
!
hadKey
)
{
key
=
toRaw
(
key
);
...
...
@@ -408,7 +435,7 @@ function deleteEntry(key) {
}
const
oldValue
=
get
?
get
.
call
(
target
,
key
)
:
undefined
;
// forward the operation before queueing reactions
const
result
=
del
.
call
(
target
,
key
);
const
result
=
target
.
delete
(
key
);
if
(
hadKey
)
{
trigger
(
target
,
"
delete
"
/* DELETE */
,
key
,
undefined
,
oldValue
);
}
...
...
@@ -418,12 +445,12 @@ function clear() {
const
target
=
toRaw
(
this
);
const
hadItems
=
target
.
size
!==
0
;
const
oldTarget
=
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
target
instanceof
Map
?
isMap
(
target
)
?
new
Map
(
target
)
:
new
Set
(
target
)
:
undefined
;
// forward the operation before queueing reactions
const
result
=
getProto
(
target
).
clear
.
call
(
target
);
const
result
=
target
.
clear
(
);
if
(
hadItems
)
{
trigger
(
target
,
"
clear
"
/* CLEAR */
,
undefined
,
undefined
,
oldTarget
);
}
...
...
@@ -448,9 +475,9 @@ function createIterableMethod(method, isReadonly, isShallow) {
return
function
(...
args
)
{
const
target
=
this
[
"
__v_raw
"
/* RAW */
];
const
rawTarget
=
toRaw
(
target
);
const
isMap
=
rawTarget
instanceof
Map
;
const
isPair
=
method
===
'
entries
'
||
(
method
===
Symbol
.
iterator
&&
i
sMap
);
const
isKeyOnly
=
method
===
'
keys
'
&&
i
sMap
;
const
targetIsMap
=
isMap
(
rawTarget
)
;
const
isPair
=
method
===
'
entries
'
||
(
method
===
Symbol
.
iterator
&&
targetI
sMap
);
const
isKeyOnly
=
method
===
'
keys
'
&&
targetI
sMap
;
const
innerIterator
=
target
[
method
](...
args
);
const
wrap
=
isReadonly
?
toReadonly
:
isShallow
?
toShallow
:
toReactive
;
!
isReadonly
&&
...
...
@@ -768,7 +795,9 @@ class ObjectRefImpl {
}
}
function
toRef
(
object
,
key
)
{
return
new
ObjectRefImpl
(
object
,
key
);
return
isRef
(
object
[
key
])
?
object
[
key
]
:
new
ObjectRefImpl
(
object
,
key
);
}
class
ComputedRefImpl
{
...
...
@@ -988,7 +1017,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
}
return
values
;
}
function
handleError
(
err
,
instance
,
type
)
{
function
handleError
(
err
,
instance
,
type
,
throwInDev
=
true
)
{
const
contextVNode
=
instance
?
instance
.
vnode
:
null
;
if
(
instance
)
{
let
cur
=
instance
.
parent
;
...
...
@@ -1014,10 +1043,10 @@ function handleError(err, instance, type) {
return
;
}
}
logError
(
err
,
type
,
contextVNode
);
logError
(
err
,
type
,
contextVNode
,
throwInDev
);
}
// fixed by xxxxxx
function
logError
(
err
,
type
,
contextVNode
)
{
function
logError
(
err
,
type
,
contextVNode
,
throwInDev
=
true
)
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
const
info
=
ErrorTypeStrings
[
type
]
||
type
;
// fixed by xxxxxx
if
(
contextVNode
)
{
...
...
@@ -1027,8 +1056,13 @@ function logError(err, type, contextVNode) {
if
(
contextVNode
)
{
popWarningContext
();
}
// crash in dev so it's more noticeable
throw
err
;
// crash in dev by default so it's more noticeable
if
(
throwInDev
)
{
throw
err
;
}
else
{
console
.
error
(
err
);
}
}
else
{
// recover in prod to reduce the impact on end-user
...
...
@@ -1202,12 +1236,6 @@ function checkRecursiveUpdates(seen, fn) {
}
}
// mark the current rendering instance for asset resolution (e.g.
// resolveComponent, resolveDirective) during render
let
currentRenderingInstance
=
null
;
function
markAttrsAccessed
()
{
}
function
emit
(
instance
,
event
,
...
args
)
{
const
props
=
instance
.
vnode
.
props
||
EMPTY_OBJ
;
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
...
...
@@ -1301,6 +1329,12 @@ function isEmitListener(options, key) {
hasOwn
(
options
,
key
.
slice
(
2
)));
}
// mark the current rendering instance for asset resolution (e.g.
// resolveComponent, resolveDirective) during render
let
currentRenderingInstance
=
null
;
function
markAttrsAccessed
()
{
}
function
initProps
(
instance
,
rawProps
,
isStateful
,
// result of bitwise flag comparison
isSSR
=
false
)
{
const
props
=
{};
...
...
@@ -1355,21 +1389,25 @@ function setFullProps(instance, rawProps, props, attrs) {
const
rawCurrentProps
=
toRaw
(
props
);
for
(
let
i
=
0
;
i
<
needCastKeys
.
length
;
i
++
)
{
const
key
=
needCastKeys
[
i
];
props
[
key
]
=
resolvePropValue
(
options
,
rawCurrentProps
,
key
,
rawCurrentProps
[
key
]);
props
[
key
]
=
resolvePropValue
(
options
,
rawCurrentProps
,
key
,
rawCurrentProps
[
key
]
,
instance
);
}
}
}
function
resolvePropValue
(
options
,
props
,
key
,
value
)
{
function
resolvePropValue
(
options
,
props
,
key
,
value
,
instance
)
{
const
opt
=
options
[
key
];
if
(
opt
!=
null
)
{
const
hasDefault
=
hasOwn
(
opt
,
'
default
'
);
// default values
if
(
hasDefault
&&
value
===
undefined
)
{
const
defaultValue
=
opt
.
default
;
value
=
opt
.
type
!==
Function
&&
isFunction
(
defaultValue
)
?
defaultValue
(
props
)
:
defaultValue
;
if
(
opt
.
type
!==
Function
&&
isFunction
(
defaultValue
))
{
setCurrentInstance
(
instance
);
value
=
defaultValue
(
props
);
setCurrentInstance
(
null
);
}
else
{
value
=
defaultValue
;
}
}
// boolean casting
if
(
opt
[
0
/* shouldCast */
])
{
...
...
@@ -1983,9 +2021,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
if
(
flush
===
'
sync
'
)
{
scheduler
=
job
;
}
else
if
(
flush
===
'
pre
'
)
{
// ensure it's queued before component updates (which have positive ids)
job
.
id
=
-
1
;
else
if
(
flush
===
'
post
'
)
{
scheduler
=
()
=>
queuePostRenderEffect
(
job
,
instance
&&
instance
.
suspense
);
}
else
{
// default: 'pre'
scheduler
=
()
=>
{
if
(
!
instance
||
instance
.
isMounted
)
{
queuePreFlushCb
(
job
);
...
...
@@ -1997,9 +2037,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
}
};
}
else
{
scheduler
=
()
=>
queuePostRenderEffect
(
job
,
instance
&&
instance
.
suspense
);
}
const
runner
=
effect
(
getter
,
{
lazy
:
true
,
onTrack
,
...
...
@@ -2016,6 +2053,9 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
oldValue
=
runner
();
}
}
else
if
(
flush
===
'
post
'
)
{
queuePostRenderEffect
(
runner
,
instance
&&
instance
.
suspense
);
}
else
{
runner
();
}
...
...
@@ -2047,13 +2087,13 @@ function traverse(value, seen = new Set()) {
traverse
(
value
[
i
],
seen
);
}
}
else
if
(
value
instanceof
Map
)
{
value
.
forEach
((
v
,
key
)
=>
{
else
if
(
isMap
(
value
)
)
{
value
.
forEach
((
_
,
key
)
=>
{
// to register mutation dep for existing keys
traverse
(
value
.
get
(
key
),
seen
);
});
}
else
if
(
value
instanceof
Set
)
{
else
if
(
isSet
(
value
)
)
{
value
.
forEach
(
v
=>
{
traverse
(
v
,
seen
);
});
...
...
@@ -2087,7 +2127,7 @@ function provide(key, value) {
provides
[
key
]
=
value
;
}
}
function
inject
(
key
,
defaultValue
)
{
function
inject
(
key
,
defaultValue
,
treatDefaultAsFactory
=
false
)
{
// fallback to `currentRenderingInstance` so that this can be called in
// a functional component
const
instance
=
currentInstance
||
currentRenderingInstance
;
...
...
@@ -2098,7 +2138,9 @@ function inject(key, defaultValue) {
return
provides
[
key
];
}
else
if
(
arguments
.
length
>
1
)
{
return
defaultValue
;
return
treatDefaultAsFactory
&&
isFunction
(
defaultValue
)
?
defaultValue
()
:
defaultValue
;
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`injection "
${
String
(
key
)}
" not found.`
);
...
...
@@ -2130,7 +2172,7 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
// assets
components
,
directives
,
// lifecycle
beforeMount
,
mounted
,
beforeUpdate
,
updated
,
activated
,
deactivated
,
before
Unmount
,
unmounted
,
render
,
renderTracked
,
renderTriggered
,
errorCaptured
}
=
options
;
beforeMount
,
mounted
,
beforeUpdate
,
updated
,
activated
,
deactivated
,
before
Destroy
,
beforeUnmount
,
destroyed
,
unmounted
,
render
,
renderTracked
,
renderTriggered
,
errorCaptured
}
=
options
;
const
publicThis
=
instance
.
proxy
;
const
ctx
=
instance
.
ctx
;
const
globalMixins
=
instance
.
appContext
.
mixins
;
...
...
@@ -2184,7 +2226,7 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
for
(
const
key
in
injectOptions
)
{
const
opt
=
injectOptions
[
key
];
if
(
isObject
(
opt
))
{
ctx
[
key
]
=
inject
(
opt
.
from
,
opt
.
default
);
ctx
[
key
]
=
inject
(
opt
.
from
||
key
,
opt
.
default
,
true
/* treat default function as factory */
);
}
else
{
ctx
[
key
]
=
inject
(
opt
);
...
...
@@ -2338,9 +2380,15 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
if
(
renderTriggered
)
{
onRenderTriggered
(
renderTriggered
.
bind
(
publicThis
));
}
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
beforeDestroy
)
{
warn
(
`
\`
beforeDestroy
\`
has been renamed to
\`
beforeUnmount
\`
.`
);
}
if
(
beforeUnmount
)
{
onBeforeUnmount
(
beforeUnmount
.
bind
(
publicThis
));
}
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
destroyed
)
{
warn
(
`
\`
destroyed
\`
has been renamed to
\`
unmounted
\`
.`
);
}
if
(
unmounted
)
{
onUnmounted
(
unmounted
.
bind
(
publicThis
));
}
...
...
@@ -2412,7 +2460,9 @@ function resolveData(instance, dataFn, publicThis) {
}
}
function
createWatcher
(
raw
,
ctx
,
publicThis
,
key
)
{
const
getter
=
()
=>
publicThis
[
key
];
const
getter
=
key
.
includes
(
'
.
'
)
?
createPathGetter
(
publicThis
,
key
)
:
()
=>
publicThis
[
key
];
if
(
isString
(
raw
))
{
const
handler
=
ctx
[
raw
];
if
(
isFunction
(
handler
))
{
...
...
@@ -2442,9 +2492,19 @@ function createWatcher(raw, ctx, publicThis, key) {
}
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`Invalid watch option: "
${
key
}
"`
);
warn
(
`Invalid watch option: "
${
key
}
"`
,
raw
);
}
}
function
createPathGetter
(
ctx
,
path
)
{
const
segments
=
path
.
split
(
'
.
'
);
return
()
=>
{
let
cur
=
ctx
;
for
(
let
i
=
0
;
i
<
segments
.
length
&&
cur
;
i
++
)
{
cur
=
cur
[
segments
[
i
]];
}
return
cur
;
};
}
function
resolveMergedOptions
(
instance
)
{
const
raw
=
instance
.
type
;
const
{
__merged
,
mixins
,
extends
:
extendsOptions
}
=
raw
;
...
...
@@ -2764,6 +2824,7 @@ function createComponentInstance(vnode, parent, suspense) {
setupContext
:
null
,
// suspense related
suspense
,
suspenseId
:
suspense
?
suspense
.
pendingId
:
0
,
asyncDep
:
null
,
asyncResolved
:
false
,
// lifecycle hooks
...
...
@@ -3017,7 +3078,7 @@ function computed$1(getterOrOptions) {
}
// Core API ------------------------------------------------------------------
const
version
=
"
3.0.0-rc.1
0
"
;
const
version
=
"
3.0.0-rc.1
2
"
;
// import deepCopy from './deepCopy'
/**
...
...
packages/uni-mp-vue/lib/vue.runtime.esm.js
浏览文件 @
4a9ce30a
import
{
EMPTY_OBJ
,
isArray
,
is
IntegerKey
,
isSymbol
,
extend
,
hasOwn
,
isObject
,
hasChanged
,
capitalize
,
toRawType
,
def
,
isFunction
,
NOOP
,
isString
,
isPromise
,
hyphenate
,
isOn
,
isReservedProp
,
camelize
,
EMPTY_ARR
,
makeMap
,
remove
,
NO
,
isGloballyWhitelisted
,
toTypeString
,
invokeArrayFns
}
from
'
@vue/shared
'
;
import
{
EMPTY_OBJ
,
isArray
,
is
Map
,
isIntegerKey
,
isSymbol
,
extend
,
hasOwn
,
isObject
,
hasChanged
,
capitalize
,
toRawType
,
def
,
isFunction
,
NOOP
,
isString
,
isPromise
,
hyphenate
,
isOn
,
isReservedProp
,
camelize
,
EMPTY_ARR
,
makeMap
,
remove
,
NO
,
isSet
,
isGloballyWhitelisted
,
toTypeString
,
invokeArrayFns
}
from
'
@vue/shared
'
;
export
{
camelize
}
from
'
@vue/shared
'
;
const
targetMap
=
new
WeakMap
();
...
...
@@ -115,7 +115,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
const
add
=
(
effectsToAdd
)
=>
{
if
(
effectsToAdd
)
{
effectsToAdd
.
forEach
(
effect
=>
{
if
(
effect
!==
activeEffect
)
{
if
(
effect
!==
activeEffect
||
effect
.
options
.
allowRecurse
)
{
effects
.
add
(
effect
);
}
});
...
...
@@ -139,15 +139,32 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
add
(
depsMap
.
get
(
key
));
}
// also run for iteration key on ADD | DELETE | Map.SET
const
shouldTriggerIteration
=
(
type
===
"
add
"
/* ADD */
&&
(
!
isArray
(
target
)
||
isIntegerKey
(
key
)))
||
(
type
===
"
delete
"
/* DELETE */
&&
!
isArray
(
target
));
if
(
shouldTriggerIteration
||
(
type
===
"
set
"
/* SET */
&&
target
instanceof
Map
))
{
add
(
depsMap
.
get
(
isArray
(
target
)
?
'
length
'
:
ITERATE_KEY
));
}
if
(
shouldTriggerIteration
&&
target
instanceof
Map
)
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
switch
(
type
)
{
case
"
add
"
/* ADD */
:
if
(
!
isArray
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
}
}
else
if
(
isIntegerKey
(
key
))
{
// new index added to array -> length changes
add
(
depsMap
.
get
(
'
length
'
));
}
break
;
case
"
delete
"
/* DELETE */
:
if
(
!
isArray
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
MAP_KEY_ITERATE_KEY
));
}
}
break
;
case
"
set
"
/* SET */
:
if
(
isMap
(
target
))
{
add
(
depsMap
.
get
(
ITERATE_KEY
));
}
break
;
}
}
const
run
=
(
effect
)
=>
{
...
...
@@ -181,22 +198,32 @@ const readonlyGet = /*#__PURE__*/ createGetter(true);
const
shallowReadonlyGet
=
/*#__PURE__*/
createGetter
(
true
,
true
);
const
arrayInstrumentations
=
{};
[
'
includes
'
,
'
indexOf
'
,
'
lastIndexOf
'
].
forEach
(
key
=>
{
const
method
=
Array
.
prototype
[
key
];
arrayInstrumentations
[
key
]
=
function
(...
args
)
{
const
arr
=
toRaw
(
this
);
for
(
let
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
track
(
arr
,
"
get
"
/* GET */
,
i
+
''
);
}
// we run the method using the original args first (which may be reactive)
const
res
=
arr
[
key
](...
args
);
const
res
=
method
.
apply
(
arr
,
args
);
if
(
res
===
-
1
||
res
===
false
)
{
// if that didn't work, run it again using raw values.
return
arr
[
key
](...
args
.
map
(
toRaw
));
return
method
.
apply
(
arr
,
args
.
map
(
toRaw
));
}
else
{
return
res
;
}
};
});
[
'
push
'
,
'
pop
'
,
'
shift
'
,
'
unshift
'
,
'
splice
'
].
forEach
(
key
=>
{
const
method
=
Array
.
prototype
[
key
];
arrayInstrumentations
[
key
]
=
function
(...
args
)
{
pauseTracking
();
const
res
=
method
.
apply
(
this
,
args
);
enableTracking
();
return
res
;
};
});
function
createGetter
(
isReadonly
=
false
,
shallow
=
false
)
{
return
function
get
(
target
,
key
,
receiver
)
{
if
(
key
===
"
__v_isReactive
"
/* IS_REACTIVE */
)
{
...
...
@@ -366,7 +393,7 @@ function add(value) {
const
target
=
toRaw
(
this
);
const
proto
=
getProto
(
target
);
const
hadKey
=
proto
.
has
.
call
(
target
,
value
);
const
result
=
proto
.
add
.
call
(
target
,
value
);
const
result
=
target
.
add
(
value
);
if
(
!
hadKey
)
{
trigger
(
target
,
"
add
"
/* ADD */
,
value
,
value
);
}
...
...
@@ -375,7 +402,7 @@ function add(value) {
function
set
$1
(
key
,
value
)
{
value
=
toRaw
(
value
);
const
target
=
toRaw
(
this
);
const
{
has
,
get
,
set
}
=
getProto
(
target
);
const
{
has
,
get
}
=
getProto
(
target
);
let
hadKey
=
has
.
call
(
target
,
key
);
if
(
!
hadKey
)
{
key
=
toRaw
(
key
);
...
...
@@ -385,7 +412,7 @@ function set$1(key, value) {
checkIdentityKeys
(
target
,
has
,
key
);
}
const
oldValue
=
get
.
call
(
target
,
key
);
const
result
=
set
.
call
(
target
,
key
,
value
);
const
result
=
target
.
set
(
key
,
value
);
if
(
!
hadKey
)
{
trigger
(
target
,
"
add
"
/* ADD */
,
key
,
value
);
}
...
...
@@ -396,7 +423,7 @@ function set$1(key, value) {
}
function
deleteEntry
(
key
)
{
const
target
=
toRaw
(
this
);
const
{
has
,
get
,
delete
:
del
}
=
getProto
(
target
);
const
{
has
,
get
}
=
getProto
(
target
);
let
hadKey
=
has
.
call
(
target
,
key
);
if
(
!
hadKey
)
{
key
=
toRaw
(
key
);
...
...
@@ -407,7 +434,7 @@ function deleteEntry(key) {
}
const
oldValue
=
get
?
get
.
call
(
target
,
key
)
:
undefined
;
// forward the operation before queueing reactions
const
result
=
del
.
call
(
target
,
key
);
const
result
=
target
.
delete
(
key
);
if
(
hadKey
)
{
trigger
(
target
,
"
delete
"
/* DELETE */
,
key
,
undefined
,
oldValue
);
}
...
...
@@ -417,12 +444,12 @@ function clear() {
const
target
=
toRaw
(
this
);
const
hadItems
=
target
.
size
!==
0
;
const
oldTarget
=
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
target
instanceof
Map
?
isMap
(
target
)
?
new
Map
(
target
)
:
new
Set
(
target
)
:
undefined
;
// forward the operation before queueing reactions
const
result
=
getProto
(
target
).
clear
.
call
(
target
);
const
result
=
target
.
clear
(
);
if
(
hadItems
)
{
trigger
(
target
,
"
clear
"
/* CLEAR */
,
undefined
,
undefined
,
oldTarget
);
}
...
...
@@ -447,9 +474,9 @@ function createIterableMethod(method, isReadonly, isShallow) {
return
function
(...
args
)
{
const
target
=
this
[
"
__v_raw
"
/* RAW */
];
const
rawTarget
=
toRaw
(
target
);
const
isMap
=
rawTarget
instanceof
Map
;
const
isPair
=
method
===
'
entries
'
||
(
method
===
Symbol
.
iterator
&&
i
sMap
);
const
isKeyOnly
=
method
===
'
keys
'
&&
i
sMap
;
const
targetIsMap
=
isMap
(
rawTarget
)
;
const
isPair
=
method
===
'
entries
'
||
(
method
===
Symbol
.
iterator
&&
targetI
sMap
);
const
isKeyOnly
=
method
===
'
keys
'
&&
targetI
sMap
;
const
innerIterator
=
target
[
method
](...
args
);
const
wrap
=
isReadonly
?
toReadonly
:
isShallow
?
toShallow
:
toReactive
;
!
isReadonly
&&
...
...
@@ -767,7 +794,9 @@ class ObjectRefImpl {
}
}
function
toRef
(
object
,
key
)
{
return
new
ObjectRefImpl
(
object
,
key
);
return
isRef
(
object
[
key
])
?
object
[
key
]
:
new
ObjectRefImpl
(
object
,
key
);
}
class
ComputedRefImpl
{
...
...
@@ -987,7 +1016,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
}
return
values
;
}
function
handleError
(
err
,
instance
,
type
)
{
function
handleError
(
err
,
instance
,
type
,
throwInDev
=
true
)
{
const
contextVNode
=
instance
?
instance
.
vnode
:
null
;
if
(
instance
)
{
let
cur
=
instance
.
parent
;
...
...
@@ -1013,10 +1042,10 @@ function handleError(err, instance, type) {
return
;
}
}
logError
(
err
,
type
,
contextVNode
);
logError
(
err
,
type
,
contextVNode
,
throwInDev
);
}
// fixed by xxxxxx
function
logError
(
err
,
type
,
contextVNode
)
{
function
logError
(
err
,
type
,
contextVNode
,
throwInDev
=
true
)
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
const
info
=
ErrorTypeStrings
[
type
]
||
type
;
// fixed by xxxxxx
if
(
contextVNode
)
{
...
...
@@ -1026,8 +1055,13 @@ function logError(err, type, contextVNode) {
if
(
contextVNode
)
{
popWarningContext
();
}
// crash in dev so it's more noticeable
throw
err
;
// crash in dev by default so it's more noticeable
if
(
throwInDev
)
{
throw
err
;
}
else
{
console
.
error
(
err
);
}
}
else
{
// recover in prod to reduce the impact on end-user
...
...
@@ -1201,12 +1235,6 @@ function checkRecursiveUpdates(seen, fn) {
}
}
// mark the current rendering instance for asset resolution (e.g.
// resolveComponent, resolveDirective) during render
let
currentRenderingInstance
=
null
;
function
markAttrsAccessed
()
{
}
function
emit
(
instance
,
event
,
...
args
)
{
const
props
=
instance
.
vnode
.
props
||
EMPTY_OBJ
;
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
...
...
@@ -1300,6 +1328,12 @@ function isEmitListener(options, key) {
hasOwn
(
options
,
key
.
slice
(
2
)));
}
// mark the current rendering instance for asset resolution (e.g.
// resolveComponent, resolveDirective) during render
let
currentRenderingInstance
=
null
;
function
markAttrsAccessed
()
{
}
function
initProps
(
instance
,
rawProps
,
isStateful
,
// result of bitwise flag comparison
isSSR
=
false
)
{
const
props
=
{};
...
...
@@ -1354,21 +1388,25 @@ function setFullProps(instance, rawProps, props, attrs) {
const
rawCurrentProps
=
toRaw
(
props
);
for
(
let
i
=
0
;
i
<
needCastKeys
.
length
;
i
++
)
{
const
key
=
needCastKeys
[
i
];
props
[
key
]
=
resolvePropValue
(
options
,
rawCurrentProps
,
key
,
rawCurrentProps
[
key
]);
props
[
key
]
=
resolvePropValue
(
options
,
rawCurrentProps
,
key
,
rawCurrentProps
[
key
]
,
instance
);
}
}
}
function
resolvePropValue
(
options
,
props
,
key
,
value
)
{
function
resolvePropValue
(
options
,
props
,
key
,
value
,
instance
)
{
const
opt
=
options
[
key
];
if
(
opt
!=
null
)
{
const
hasDefault
=
hasOwn
(
opt
,
'
default
'
);
// default values
if
(
hasDefault
&&
value
===
undefined
)
{
const
defaultValue
=
opt
.
default
;
value
=
opt
.
type
!==
Function
&&
isFunction
(
defaultValue
)
?
defaultValue
(
props
)
:
defaultValue
;
if
(
opt
.
type
!==
Function
&&
isFunction
(
defaultValue
))
{
setCurrentInstance
(
instance
);
value
=
defaultValue
(
props
);
setCurrentInstance
(
null
);
}
else
{
value
=
defaultValue
;
}
}
// boolean casting
if
(
opt
[
0
/* shouldCast */
])
{
...
...
@@ -1982,9 +2020,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
if
(
flush
===
'
sync
'
)
{
scheduler
=
job
;
}
else
if
(
flush
===
'
pre
'
)
{
// ensure it's queued before component updates (which have positive ids)
job
.
id
=
-
1
;
else
if
(
flush
===
'
post
'
)
{
scheduler
=
()
=>
queuePostRenderEffect
(
job
,
instance
&&
instance
.
suspense
);
}
else
{
// default: 'pre'
scheduler
=
()
=>
{
if
(
!
instance
||
instance
.
isMounted
)
{
queuePreFlushCb
(
job
);
...
...
@@ -1996,9 +2036,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
}
};
}
else
{
scheduler
=
()
=>
queuePostRenderEffect
(
job
,
instance
&&
instance
.
suspense
);
}
const
runner
=
effect
(
getter
,
{
lazy
:
true
,
onTrack
,
...
...
@@ -2015,6 +2052,9 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
oldValue
=
runner
();
}
}
else
if
(
flush
===
'
post
'
)
{
queuePostRenderEffect
(
runner
,
instance
&&
instance
.
suspense
);
}
else
{
runner
();
}
...
...
@@ -2046,13 +2086,13 @@ function traverse(value, seen = new Set()) {
traverse
(
value
[
i
],
seen
);
}
}
else
if
(
value
instanceof
Map
)
{
value
.
forEach
((
v
,
key
)
=>
{
else
if
(
isMap
(
value
)
)
{
value
.
forEach
((
_
,
key
)
=>
{
// to register mutation dep for existing keys
traverse
(
value
.
get
(
key
),
seen
);
});
}
else
if
(
value
instanceof
Set
)
{
else
if
(
isSet
(
value
)
)
{
value
.
forEach
(
v
=>
{
traverse
(
v
,
seen
);
});
...
...
@@ -2086,7 +2126,7 @@ function provide(key, value) {
provides
[
key
]
=
value
;
}
}
function
inject
(
key
,
defaultValue
)
{
function
inject
(
key
,
defaultValue
,
treatDefaultAsFactory
=
false
)
{
// fallback to `currentRenderingInstance` so that this can be called in
// a functional component
const
instance
=
currentInstance
||
currentRenderingInstance
;
...
...
@@ -2097,7 +2137,9 @@ function inject(key, defaultValue) {
return
provides
[
key
];
}
else
if
(
arguments
.
length
>
1
)
{
return
defaultValue
;
return
treatDefaultAsFactory
&&
isFunction
(
defaultValue
)
?
defaultValue
()
:
defaultValue
;
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`injection "
${
String
(
key
)}
" not found.`
);
...
...
@@ -2129,7 +2171,7 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
// assets
components
,
directives
,
// lifecycle
beforeMount
,
mounted
,
beforeUpdate
,
updated
,
activated
,
deactivated
,
before
Unmount
,
unmounted
,
render
,
renderTracked
,
renderTriggered
,
errorCaptured
}
=
options
;
beforeMount
,
mounted
,
beforeUpdate
,
updated
,
activated
,
deactivated
,
before
Destroy
,
beforeUnmount
,
destroyed
,
unmounted
,
render
,
renderTracked
,
renderTriggered
,
errorCaptured
}
=
options
;
const
publicThis
=
instance
.
proxy
;
const
ctx
=
instance
.
ctx
;
const
globalMixins
=
instance
.
appContext
.
mixins
;
...
...
@@ -2183,7 +2225,7 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
for
(
const
key
in
injectOptions
)
{
const
opt
=
injectOptions
[
key
];
if
(
isObject
(
opt
))
{
ctx
[
key
]
=
inject
(
opt
.
from
,
opt
.
default
);
ctx
[
key
]
=
inject
(
opt
.
from
||
key
,
opt
.
default
,
true
/* treat default function as factory */
);
}
else
{
ctx
[
key
]
=
inject
(
opt
);
...
...
@@ -2337,9 +2379,15 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
if
(
renderTriggered
)
{
onRenderTriggered
(
renderTriggered
.
bind
(
publicThis
));
}
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
beforeDestroy
)
{
warn
(
`
\`
beforeDestroy
\`
has been renamed to
\`
beforeUnmount
\`
.`
);
}
if
(
beforeUnmount
)
{
onBeforeUnmount
(
beforeUnmount
.
bind
(
publicThis
));
}
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
destroyed
)
{
warn
(
`
\`
destroyed
\`
has been renamed to
\`
unmounted
\`
.`
);
}
if
(
unmounted
)
{
onUnmounted
(
unmounted
.
bind
(
publicThis
));
}
...
...
@@ -2411,7 +2459,9 @@ function resolveData(instance, dataFn, publicThis) {
}
}
function
createWatcher
(
raw
,
ctx
,
publicThis
,
key
)
{
const
getter
=
()
=>
publicThis
[
key
];
const
getter
=
key
.
includes
(
'
.
'
)
?
createPathGetter
(
publicThis
,
key
)
:
()
=>
publicThis
[
key
];
if
(
isString
(
raw
))
{
const
handler
=
ctx
[
raw
];
if
(
isFunction
(
handler
))
{
...
...
@@ -2441,9 +2491,19 @@ function createWatcher(raw, ctx, publicThis, key) {
}
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`Invalid watch option: "
${
key
}
"`
);
warn
(
`Invalid watch option: "
${
key
}
"`
,
raw
);
}
}
function
createPathGetter
(
ctx
,
path
)
{
const
segments
=
path
.
split
(
'
.
'
);
return
()
=>
{
let
cur
=
ctx
;
for
(
let
i
=
0
;
i
<
segments
.
length
&&
cur
;
i
++
)
{
cur
=
cur
[
segments
[
i
]];
}
return
cur
;
};
}
function
resolveMergedOptions
(
instance
)
{
const
raw
=
instance
.
type
;
const
{
__merged
,
mixins
,
extends
:
extendsOptions
}
=
raw
;
...
...
@@ -2763,6 +2823,7 @@ function createComponentInstance(vnode, parent, suspense) {
setupContext
:
null
,
// suspense related
suspense
,
suspenseId
:
suspense
?
suspense
.
pendingId
:
0
,
asyncDep
:
null
,
asyncResolved
:
false
,
// lifecycle hooks
...
...
@@ -3016,7 +3077,7 @@ function computed$1(getterOrOptions) {
}
// Core API ------------------------------------------------------------------
const
version
=
"
3.0.0-rc.1
0
"
;
const
version
=
"
3.0.0-rc.1
2
"
;
// import deepCopy from './deepCopy'
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录