js的indexOf方法
注释:indexOf() 方法对大小写敏感!
注释:如果要检索的字符串值没有出现,则该方法返回 -1。
1.
test: Array<any>=["test/test","mast/mast"];//菜單
2.
//判斷是否可以查看此按鈕的方法 isAuth () { return this.test.indexOf('mast/mast') !== -1 || false; }
3.在頁面中可以這樣調用(通過if方法判斷是否顯示)
<button nz-button class="btn-purple" *ngIf="isAuth('mast/mast')"></button>