<tooltip message="Click Tooltip" content="Click tooltip preview"></tooltip>
<tooltip message="Click Tooltip 1" class="repeat-tooltip" content="Click tooltip 1 preview"></tooltip>
<tooltip trigger="hover" class="repeat-tooltip" message="Hover Tooltip" content="Hover tooltip preview"></tooltip>
Riot.js 的新手尝试创建自定义工具提示标签,并且一次只有一个工具提示处于活动状态。
<tooltip>
<p class="tooltip-content" control="tooltip">{ message } ref="target"</p>
<div class="tooltip-wrapper" show={show_message} ref="content">
//inner html
</div>
</tooltip>
尝试使用 show 切换 show_message 值来显示和隐藏工具提示。但 show_message 是在特定元素单击事件的上下文中。Onclick 特定工具提示,如果该工具提示已打开,我如何访问其他自定义标签的上下文以隐藏该特定元素的值?
this.root.addEventListener('click', (e) => that.toggle_message(e));
this.toggle_message = function(e) {
//here close all other tooltips before opening this one. How can I access the refs of all the open tooltip?
this.show_message = !this.show_message;
this.update();
};
提前致谢。