How to remove small caret from ion-select in ionic4

前端 未结 10 1178
春和景丽
春和景丽 2021-01-17 22:21

I want to remove the inbuilt grey small caret from ion-select, and use my custom caret(arrow) instead.

Code:

ion-select {
  color: grey         


        
10条回答
  •  执笔经年
    2021-01-17 23:03

    If you want just remove the carets, you can do this:

    // ...other page methods
    
      ionViewDidEnter() {
        const ionSelects = document.querySelectorAll('ion-select');
        ionSelects.forEach((sel) => {
          sel.shadowRoot.querySelectorAll('.select-icon-inner')
            .forEach((elem) => {
              elem.setAttribute('style', 'display: none;');
            });
        });
      }
    

    Based on @Sangminem response

    In addition, in my case, I'm using slot="end" with an ion-icon to place a replacement icon:

    
      Label
    
      
        Option 1
        Option 2
        Option 3
      
    
      
    
    

提交回复
热议问题