Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js: uppercase doesn't work

i have this code:

data: {
    cols: ['nome', 'data', 'size', 'ext'],
    items: []
},

I would need to turn the text into uppercase. I tried this way, following the examples of the official site:

<th v-for="col in cols">
  {{col | uppercase}}
</th>

However, the text remains in lowercase. do you know why??

like image 714
matteo Avatar asked Jun 12 '17 07:06

matteo


1 Answers

There's an alternative and simpler way to do this. Instead of using @wostex's approach for filters, you can use Javascript directly inside double bracket notation.

new Vue({
  el: '#app',
  data: {
    cols: ['nome', 'data', 'size', 'ext']
  }
});
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
  <table>
    <thead>
      <th v-for="col in cols">
        {{ col.toUpperCase() }}
      </th>
    </thead>
  </table>
</div>
like image 181
Kaung Myat Lwin Avatar answered Oct 26 '22 22:10

Kaung Myat Lwin