Element UI checkbox 使用 key 绑定

<el-checkbox-group v-model="languageForm.language" @change="onChange">
        <div v-for="item in languageOptions" :key="item.key">
                <el-checkbox :label="item.key" name="language">@{{item.title}}</el-checkbox>
        </div>
</el-checkbox-group>

 languageOptions: [
                    {
                        key: 'cn',
                        title: '简体中文',
                        flag: 'http://www.nanodream.net/public/images/flag/cn.gif'
                    },
                    {
                        key: 'en',
                        title: '英语',
                        flag: 'http://www.nanodream.net/public/images/flag/en.gif'
                    },
                    {
                        key: 'fa',
                        title: '波斯语',
                        flag: 'http://www.nanodream.net/public/images/flag/fa.gif'
                    },
                    {
                        key: 'ar',
                        title: '阿拉伯语',
                        flag: 'http://www.nanodream.net/public/images/flag/ar.gif'
                    },
                    {
                        key: 'ms',
                        title: '马来语',
                        flag: 'http://www.nanodream.net/public/images/flag/ms.gif'
                    },
                    {
                        key: 'bn',
                        title: '孟加拉语',
                        flag: 'http://www.nanodream.net/public/images/flag/bn.gif'
                    },
                    {
                        key: 'ur',
                        title: '乌尔都语',
                        flag: 'http://www.nanodream.net/public/images/flag/ur.gif'
                    },
                    {
                        key: 'tr',
                        title: '土耳其语',
                        flag: 'http://www.nanodream.net/public/images/flag/tr.gif'
                    },
                    {
                        key: 'id',
                        title: '印尼语',
                        flag: 'http://www.nanodream.net/public/images/flag/id.gif'
                    }
                ],
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容