fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

display dynamic name on list? #27

Closed youyi1314 closed 6 years ago

youyi1314 commented 6 years ago

At title, i got this data

members:[
{ name:first_name,display:this.user.first_name},
{name:last_name,display:this.user.last_name},
{name:today_function_time,display:'Show Dynamic time from computed?'}
]

here is my template

<template slot="item" scope="s">
    <span v-text="s.item.display"></span>
</template>

when i use "@" it will show the text below:

Jason
Lee
*Dynamic Time

wish you can understand what i mean. Thanks

fritx commented 6 years ago

@youyi1314 You want the name to support function-typed? https://github.com/fritx/vue-at/blob/dev/src/At.vue#L104-L107

itemName (v) {
  const { nameKey } = this
+  if (typeof nameKey === 'function') {
+    nameKey = nameKey()
+  }
  return nameKey ? v[nameKey] : v
},

No problem but I still don't understand well your use case, lol..

youyi1314 commented 6 years ago

@fritx Thanks for your reply actually what I want is the name and the s.item.display dynamic some data I retried from API. like that day function for today have 3 timetables, 1.3pm 2.6pm 3.8pm

youyi1314 commented 6 years ago

I found what i actually need #16

fritx commented 6 years ago

@youyi1314 awesome! that would be published soon