SHARE
TWEET

Untitled

a guest Jun 18th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <b-table class="col-sm-12 table-sm" show-empty striped hover stacked="md" tbody-tr-class="addPointer"
  2.                 :items="filter"
  3.                 :fields="fields"
  4.                 @filter="onFilter"
  5.             >
  6.  
  7.             <template slot="top-row" >
  8.                 <td v-for="field in Object.keys(fields)" :key="field.key">
  9.                     <input class="col-sm" v-if="Object.keys(filters).indexOf(field) !== -1" v-model="filters[field]" :placeholder="field">
  10.                 </td>
  11.             </template>
  12.             <template slot="name" slot-scope="row">
  13.                 {{row.item.name}}
  14.             </template>
  15.         </b-table>
  16.      
  17. data() {
  18.    return {
  19.  
  20.         filters: {
  21.                 name:'',
  22.         },
  23.        }
  24.      },
  25.      computed:{
  26.         filter () {
  27.             const filter = this.datas.filter(value => {
  28.                     String(value[key]).includes(this.filters[key]))
  29.             })
  30.             return filter.length > 0 ? filter : [
  31.                 {
  32.                     name:'',
  33.                 }
  34.             ]
  35.         },
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