本机RadDataForm工具提示

时间:2019-04-15 22:32:13

标签: vue.js nativescript

您好,我使用nativescript vue数据格式 https://docs.nativescript.org/vuejs/ns-ui/DataForm/dataform-editors-providers 就像在此链接中一样,我得到了如下的代码。

您可以看到我要在何处添加 displayName 属性,例如-?要启动工具提示,请在用户希望获取信息时单击。

是否可以在此处放置带有ref的图标/标签?

 export default {
  data () {
      return {
        mainTabMetadata: {
          'isReadOnly': false,
          'commitMode': 'OnLostFocus',
          'validationMode': 'Immediate',
          'propertyAnnotations':
          [
             {
              "name": "m_actualHP",
              "displayName": "HP actual value" <Label ref="tooltip" v-else class="icon red fa bigger-fa" :text="'fa-times-circle' | fonticon" />,
              "index": 0,
              "editor": "Number"
             },  
             {
              "name": "m_refreshHP",
              "displayName": "Refreshing",
              "index": 1,
              "editor": "Number"
             },  
             {
              "name": "m_actualMP",
              "displayName": "MP actual value",
              "index": 2,
              "editor": "Number"
             },
             {
              "name": "m_refreshMP",
              "displayName": "Refreshing",
              "index": 3,
              "editor": "Number"
             },

          ],
        },
      }  
  }
}

现在我有这样的按钮

<Button text="Get Json Data" ref="tooltip" @tap="onLoaded" class="btn btn-primary m-t-20"></Button>

并在方法onLoaded方法中运行工具提示。所以有可能在元数据中放置标签?

可能可以将工具提示分配给name =“ m_actualHP”的raddataform的特定字段。我可以让它工作吗?

  methods: {
     onLoaded: function(args) {
        const ToolTip = require("nativescript-tooltip").ToolTip;
        const tip = new ToolTip(args.object, {
            text: "Some Text",
            backgroundColor: "pink",
            textColor: "black"
        });
        tip.show();
    }

我发现我可以像这样获得raddata对象

let property = data.object.getPropertyByName(data.propertyName);

,然后打开属性名称,使工具提示具有不同的文本。

 if (property.name == "m_actualHP"){
            console.log("m_actualHP");

            const ToolTip = require("nativescript-tooltip").ToolTip;
            const tip = new ToolTip(data.object, {
                text: "Some Text",
                backgroundColor: "pink",
                textColor: "black"
            });
            tip.show();
        }

,但仅当有人在文本字段中输入一些值时才会显示。 是否有可能对radadataform或类似的东西进行触摸事件?来检测对焦点的关注,然后焦点会显示工具提示?

0 个答案:

没有答案