嗨,我正在使用此nativescript插件:
https://github.com/triniwiz/nativescript-accordion
我有以下代码:
<StackLayout>
<Accordion height="100%" [items]="items" allowMultiple="false" [selectedIndexes]="selectedIndexes">
<ng-template let-i="index" let-item="item" acTemplateKey="title">
<Label [text]="item.header"></Label>
</ng-template>
<ng-template let-i="index" let-item="item" acTemplateKey="content">
<ng-container *ngIf="item.type === 'product-wallet'">
<Label text="WAHAHAHA"></Label>
</ng-container>
<!-- <app-product-transfer *ngIf="item.type === 'product-wallet'"></app-product-transfer> -->
</ng-template>
</Accordion>
</StackLayout>
此模板引发错误,提示:
控制台错误[本机代码]:错误TypeError:未定义不是 对象(评估'newIndexes.length')控制台错误[本地代码]: 错误上下文{“ view”:{“ def”:{“ nodeFlags”:639027201, “ rootNodeFlags”:1,“ nodeMatchedQueries”:2,“ flags”:0,“ nodes”:[{ “ nodeIndex”:0,“ parent”:空,“ renderParent”:空,“ bindingIndex”: 0,“ outputIndex”:0,“ checkIndex”:0,“ flags”:1,“ childFlags”: 639027201,“ directChildFlags”:33554433,“ childMatchedQueries”:2, “ matchedQueries”:{},“ matchedQueryIds”:0,“ references”:{}, “ ngContentIndex”:null,“ childCount”:8,“ bindings”:[], “ bindingFlags”:0,“输出”:[],“ element”:{“ ns”:“”,“ name”: “ StackLayout”,“ attrs”:[],“ template”:null,“ componentProvider”: null,“ componentView”:null,“ componentRendererType”:null, “ publicProvider <…> NativeScript捕获到信号11。Native Stack:1
0x10f2d81df sig_handler(int)2 0x112f16b5d _sigtramp 3 0x1240cba00 4 0x113c7db65-[UITableView _createPreparedCellForGlobalRow:willDisplay:] 5 0x113cad363-[_ UITableViewUpdateSupport(Private)_setupAnimationsForNewlyInsertedCells] 6 0x113cb726b-[_ UITableViewUpdateSupport _setupAnimations] 7 0x113c4b610-[UITableView _UpdateWithItems5 -Update_Table5Views_Update_Items_5带有控件的内容更新:[TableUI_5_xUI_View_View_View_View_Cs_Update_View5_x5_x5.png :headerFooterOnly:usingPresentationValues] 10 0x113c5c99c-[UITableView reloadSections:withRowAnimation:] 11 0x14132d676-[UITableViewAccessibility reloadSections:withRowAnimation:] 12 0x10fbf451d ffi_call_unix64 13 0x126482db0 JS堆栈:1 reloadSectionsWithRowAnimation @ [本地代码] 2 reloadSection @ file:///app/vendor.js:123034:49 3
handleTap @ file:///app/vendor.js:123077:26 4
tableViewWillSelectRowAtIndexPath @ file:///app/vendor.js:122990:22 5
UIApplicationMain @ [本地代码] 6
start @ file:///app/vendor.js:149361:26 7
run @ file:///app/vendor.js:149389:10 8
bootstrapNativeScriptApp @ file:///app/vendor.js:125890:26 9
bootstrapApp @ file:///app/vendor.js:125791:38 10 bootstrapModule @ file:///app/vendor.js:125775:26 11 @file:///app/bundle.js:8255:144 12 ./main.ts@file:///app/bundle.js:8260:34 13 webpack_require @file:///app/bundle.js:752:34 14 checkDeferredModules @ file:///app/bundle.js:45:42 15 @file:///app/bundle.js:828:38 16 匿名@文件:///app/bundle.js:829:12 17评估@ [本地代码] 18 moduleEvaluation @:1:11 19 promiseReactionJob @:1:11 20 require @ [本机代码] 21onymous @ file:///app/starter.js:2:8 22 评估@ [本地代码] 23模块评估@:1:11 24 promiseReactionJob @:1:11
但是当我尝试删除ngIf一切正常时。为什么会这样?
谢谢!