How to pass key as select option value in v-for when changed (VueJS)
P粉916553895
P粉916553895 2023-11-17 08:55:24
0
1
681

I'm usingVue 3andBootstrap 5.

I have aselectwith multiple options. Now I'm displaying myoption.TEXTand when I change something, thisvaluewill also be passed into my method. But when I change something, I want to passkey(option.ID).

But I also want myv-modelto be myoption.IDbut show myoption.TEXT.

How to achieve this without checking the method itself.

choose:

Option array:

[ { "ID": 1, "TEXT": "One" }, { "ID": 2, "TEXT": "Two" }, { "ID": 3, "TEXT": "Three" }, ]


P粉916553895
P粉916553895

reply all (1)
P粉848442185

optionThe property value should be bound tooption.ID:

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!