得到一个标签的数量; 也就是说,在标签范围内使用标签的次数。如果标签不存在,则为零。

getCount(tag)

参数

  • tag
    标签名。

返回值

表示标签使用数的整数。

代码例

以下代码段将返回标签“cool”的使用次数:

var node = companyhome.childByNamePath("TAG_SCOPE_FOLDER/TEST_FILE_1.TXT");
if (node) {
    model.message = "Node found";

    var tagScope = node.getTagScope();
    if (tagScope){
        model.tags = tagScope.tags;
        model.count = tagScope.getCount("cool");
    }
} else {
    model.message = "Node not found!";
}
文档更新时间: 2019-07-10 23:20   作者:凌云文档