使用ember power select,需要显示一些选项 禁用,怎么做。不知道如何继续,选项将是 根据服务器端值动态禁用。
// in your Child Theme's functions.php
// Use the after_setup_theme hook with a priority of 11 to load after the
// parent theme, which will fire on the default priority of 10
add_action( 'after_setup_theme', 'remove_post_formats', 11 );
function remove_post_formats() {
remove_theme_support( 'post-formats' );
add_theme_support( 'post-formats', array( 'video' ) );
}
答案 0 :(得分:1)
我还没有尝试过,但是你能做的就是编写一个帮助器(比如should-be-disabled
)决定是否应该禁用一个值,如果是,则添加一个css类helper返回true。用法如下:
{{#power-select options=names onchange=(action "foo") as |name|}}
<span class={{if (should-be-disabled name) 'item-disabled'}}>{{name}}</span>
{{/power-select}}
您的项目禁用类看起来像这样:
.item-disabled {
color: gray;
pointer-events: none;
cursor: not-allowed;
}