fritx / vue-at

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

v-model 的 textarea 不支持吗? #29

Open youyi1314 opened 6 years ago

youyi1314 commented 6 years ago
<at-ta at="@" :members="members" name-key="name">
    <template slot="item" slot-scope="s">
        <span v-text="s.item.display"></span>
    </template>
    <textarea class="form-control m-input" v-model.trim="messages" rows="3"></textarea>
</at-ta>
export default {
           data() {
            return {
                        messages: 'This is message'
                        members: [
                                            {
                                                name:'first_name',
                                            display: 'Customer First Name',
                                            },
                                        {
                                                name:'last_name',
                                         display: 'Customer Last Name',
                                            },
                                        {
                                                name:'full_name',
                                                display: 'Customer Full Name',
                                           }
                       ],
            }
           }
}

当输入@的时候会显示列表,但是点击后却没有输入 name 到框内 只保留了 @。 我的messages data是一个修改框。 就是说会将服务器内的数据库显示再 messages data内。 我测试了 只要去掉

v-model.trim="messages" 就可以正常使用。我也尝试换成

:value="messages" 换成 value 后 就连 @ 的列表都闪关 我这个情况下还有什么方式可以使用吗? 因为我的 messages 是动态框 所以必须用 :value 或者 v-model

sentiasa commented 6 years ago

I am not sure about what you are exactly trying to achieve but I think I need the same thing. Customised list view (images & names) with textarea. Is this what you are trying to do too?

youyi1314 commented 6 years ago

customize list you can try the code above. But the problem i face is ,ehen i select the item from the list, it dont effect. It alway show @ only ,it cant input @first_name after i choose the Customer First Name from list.

youyi1314 commented 6 years ago

@sentiasa for your part, u may check here. https://fritx.github.io/vue-at/#/en/customtemplates

fritx commented 6 years ago

@youyi1314 yeah, v-model is not supported for now.

Related issues: https://github.com/fritx/vue-at/issues/8#issuecomment-304666006, https://github.com/fritx/vue-at/issues/22#issuecomment-338448820, #38 (PR)

fritx commented 6 years ago

I think we could work out a proper way to solve the problem, stay in tune.

fritx commented 6 years ago

v-model is not supported yet, but now I'm very interested in landing it: <at v-model="text"></a> ??

a related PR: #38

fritx commented 4 years ago

这个现在应该是支持的