I've been attempting to create a basic sorting function, but it doesn't seem to be functioning correctly.
var Main = {
data() {
return {
tableData: [{
value: '1.799,37',
name: 'Tom 3'
}, {
value: '2.183,88',
name: 'Tom 2'
}, {
value: '3.837,05',
name: 'Tom 4'
}, {
value: '769,8',
name: 'Tom 6'
}, {
value: '111,8',
name: 'Tom 6'
}, {
value: '999,8',
name: 'Tom 6'
}]
}
},
methods: {
test: function(a, b) {
return a.value - b.value;
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
@import url("//unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88ede4ede5ede6fca5fde1c8b9a6bba6bc">[email protected]</a>/lib/theme-default/index.css");
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7d2dbd2dad2d9c39ac2def78699849983">[email protected]</a>/lib/index.js"></script>
<div id="app">
<template>
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="value" label="Value" sortable :sort-method=test width="180"></el-table-column>
<el-table-column prop="name" sortable label="Name" width="180"></el-table-column>
</el-table>
</template>
</div>