我需要在vuejs中运行类似jq的功能:
- html
@foreach($users as $user)
status == 'active') selected @endif value="active">Active
status == 'wait_confirm') selected @endif value="wait_confirm">Wait Confirm
`
- jq
`$('.check-change').on('change', function() {
var new_value = this.value;
-> send request update user (this.attr('data-id'))
});
我被卡住了,因为我不知道如何在vue js中检查并添加选中的属性,也不知道当用户的选择器发生变化时如何获取用户id和选中的选项。
当前代码:
const items_status = [
{
state: 'Active',
abbr: 'active',
},
{
state: 'Wait Confirm',
abbr: 'wait_confirm',
}
];
const selectedOption = ref({
state: 'Wait Confirm',
abbr: 'wait_confirm',
})
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号