drop-down-menu - 未找到元素“nativescript-drop-down:DropDown”的模块“nativescript-drop-down”
问题描述
我收到以下错误。
来自设备 Savas 的日志:“主”线程上发生未捕获的异常。调用 js 方法 onClick 失败错误:从 XML 构建 UI。@purchase/page.xml:3:5
未找到元素“nativescript-drop-down:DropDown”的模块“nativescript-drop-down”。无法读取未定义的属性“setNative”
StackTrace:SourceError(file:///data/数据/org.nativescript.preview/files/app/tns_modules/@nativescript/core/utils/debug.js:74:23)
我的源代码:Xml 文件
<!--
`<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" xmlns:dd="nativescript-drop-down">
<GridLayout rows="auto, auto, *" columns="auto, *">
<dd:DropDown items="{{ items }}" selectedIndex="{{ selectedIndex }}"
opened="dropDownOpened" closed="dropDownClosed"
selectedIndexChanged="dropDownSelectedIndexChanged"
row="0" colSpan="2" />
<Label text="Selected Index:" row="1" col="0" fontSize="18" verticalAlignment="bottom"/>
<TextField text="{{ ad }}" row="1" col="1" />
</GridLayout>
</Page>`
-->
JS文件
const fromObject = require("tns-core-modules/data/observable").fromObject;
exports.pageLoaded = function (args) {
const items = [];
items.push({
ad: "Batman"
});
items.push({
ad: "Joker"
});
items.push({
ad:"Bane"
});
const page = args.object;
const vm = fromObject({
items: items
});
page.bindingContext = vm;
}
解决方案
很抱歉问这个显而易见的问题,但是您确实安装了插件,是吗?
tns plugin add nativescript-drop-down
推荐阅读
- html - 如何显示搜索结果?
- azure - 如何使用反向代理机制模拟 Azure Cosmos DB 和 Azure Redis 区域故障场景?
- php - 学生总分从高到低排序
- flutter - Hive - Flutter 中的固定长度列表错误
- java - 我在 Android 应用(Java)和 ESP32 BLE 服务器之间的 Gatt 连接有问题
- mysql - Firestore-如何有效地从集合 A 中获取集合 B 中不存在的文档
- regex - 正则表达式 - 匹配前 1000 个符号
- javascript - 谷歌日历推送通知 404 错误
- docker - 无法在 docker 映像中获取 go 模块
- javascript - Stripe 客户端密码无法在移动设备上运行