-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Description
When in strict asset resolve mode, I have no idea how to repeat component. For example as followed, the console will report that the inner
component cannot be resolved.
<outer>
<template v-repeat="item in data">
<inner prop={{item.prop}}>{{item.value}}</inner>
</template>
</outer>
Because when resolving the inner
, the resolveAsset
is checking the options._parent
, not the _context
...the modified code is something like:
// for util/options/resolveAsset
while (!asset && (!config.strict || options._repeat)) {
if (options._repeat) {
if (!options._context) {
break
}
options = options._context.$options
} else {
if (!options._parent) {
break
}
options = options._parent.$options
}
assets = options[type]
asset = assets[id] || assets[camelizedId] || assets[pascalizedId]
}
Of course, we can try another approach if only one component and no needs to pass repeated data to component, but the ability to repeat block will be lost. For example
<outer>
<inner v-repeat="item in data">{{item}}</inner>
</outer>
However, the code above can work without any errors, but the result is wrong...the {{item}}
will always be empty (undefined
)... Because the {{item}}
is linked within the _context
, even if the item
is set into the inner
instance...
Metadata
Metadata
Assignees
Labels
No labels