Set vue datatable property value dynamically.

Set vue datatable property value dynamically.

mshahmshah Posts: 19Questions: 5Answers: 1
edited May 2023 in Free community support

I am trying to do this : https://stackblitz.com/edit/vue-pweivu?file=src%2FApp.vue

However, it does not {{userLogin}} in the DataTable. How can I get the returned variable from setup to map into the DataTable property?

It gives the error:
ERROR in ./src/views/home/Home.vue?vue&type=template&id=3dd2e005 (./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/home/Home.vue?vue&type=template&id=3dd2e005)
Module Error (from ./node_modules/vue-loader/dist/templateLoader.js):

VueCompilerError: Error parsing JavaScript expression: Unexpected token
at /home/manish/repos/rlms/ui/src/views/home/Home.vue:

Answers

  • allanallan Posts: 61,605Questions: 1Answers: 10,085 Site admin

    Yes, that's not how Vue's template strings work. You can't put one inside a dynamic object. You'll need to refer to the Vue documentation for full details on how templates work, but what I would suggest is that you move the entire object for options into your setup function and then just reference that in your component attributes - e.g.:

    options: options
    

    Allan

Sign In or Register to comment.