具有这部分代码形式:
<RadDataForm id="loginForm" ref="loginForm" :source="user">
<TKEntityProperty v-tkDataFormProperty name="password" displayName imageResource="res://lock" hintText="Password" index="0">
<TKPropertyEditor v-tkEntityPropertyEditor type="Password">
<TKPropertyEditorStyle v-tkPropertyEditorStyle labelWidth="4" />
</TKPropertyEditor>
</TKEntityProperty>
</RadDataForm>
需要添加图标/图像可以点击以显示/隐藏密码
答案 0 :(得分:1)
如果我没记错,CustomPropertyEditor尚未在最新版本的nativescript-ui-dataform插件(截至今天的v4.0.0)中作为Vue指令公开。
因此您必须先将其与RadDataForm一起注册,可能类似于
import Vue from 'nativescript-vue';
import * as RadDataFormModule from "nativescript-ui-dataform";
import RadDataForm from "nativescript-ui-dataform/vue";
Vue.use(RadDataForm);
Vue.registerElement("TKCustomPropertyEditor", function () {
return RadDataFormModule.CustomPropertyEditor;
});
现在只需使用TKCustomPropertyEditor
而不是TKPropertyEditor
<TKEntityProperty v-tkDataFormProperty name="password">
<TKCustomPropertyEditor v-tkEntityPropertyEditor
@editorNeedsView="onPasswordEditorNeedsView">
</TKCustomPropertyEditor>
</TKEntityProperty>
现在,您可以按照文档所述在editorNeedsView
事件上创建并分配所需的视图。