Skip to content
Snippets Groups Projects
Ordering.vue 605 B
Newer Older
  • Learn to ignore specific revisions
  • <script>
    export default {
      props: {
        defaultOrdering: {type: String, required: false}
      },
      methods: {
        getOrderingFromString (s) {
          let parts = s.split('-')
          if (parts.length > 1) {
            return {
              direction: '-',
              field: parts.slice(1).join('-')
            }
          } else {
            return {
    
              field: s
            }
          }
        },
        getOrderingAsString () {
    
          let direction = this.orderingDirection
          if (direction === '+') {
            direction = ''
          }
          return [direction, this.ordering].join('')