SHARE
TWEET

Untitled

a guest Jun 16th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { LightningElement, track, api } from 'lwc';
  2.  
  3. export default class App extends LightningElement {
  4.  
  5.  
  6.     @track infoText;
  7.     @track data = [];
  8.  
  9.     handleItemRemove(e) {
  10.         this.infoText = e.detail.item.name
  11.     }
  12.  
  13.     handleClickW(e) {
  14.         this.data.push({ label: 'a ' + this.data.length, name: 'b' + this.data.length })
  15.         this.redraw = true;
  16.         this.infoText = 'Count:' + this.data.length;
  17.     }
  18. }
  19.      
  20. <template>
  21.     <div class="slds-m-vertical_medium">
  22.         <p>Info: <span class="slds-text-heading_small">{infoText}</span></p>
  23.     </div>
  24.     <div>
  25.         <lightning-button label="Neutral" title="Neutral action"
  26.         onclick={handleClickW} class="slds-m-left_x-small"></lightning-button>
  27.     </div>
  28.  
  29.  
  30.      <lightning-pill-container items={data} onitemremove={handleItemRemove}>
  31.     </lightning-pill-container>
  32.  
  33. </template>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top