Giter VIP home page Giter VIP logo

Comments (4)

Aaron-zon avatar Aaron-zon commented on July 22, 2024

image

from ant-design-vue.

Dylan-lijl avatar Dylan-lijl commented on July 22, 2024

image

不一样,你这个示例没有label属性,大部分场景显示label而不是value,当只有value值label就会失效,这又回到之前说的bug

from ant-design-vue.

Aaron-zon avatar Aaron-zon commented on July 22, 2024

哦哦,我懂了,那这个看起来确实不行。

from ant-design-vue.

hdtopku avatar hdtopku commented on July 22, 2024

确实是个 bug


const selectedRoleIds = ref<string[]>([]);
let roleList = ref([{"1":"超级管理员"},{"2":"开发者"}])
const filteredOptions = computed(() => {
return roleList.value.filter((item:any) => !selectedRoleIds.value.includes(item.id)).map(item => ({
    value: item.id,
    label: item.roleName
  }))
})
 <a-select key="id" allow-clear v-model:value="selectedRoleIds" mode="multiple"
                  :options="filteredOptions" placeholder="请选择角色">
          <template #tagRender="{ value: val, label, closable, onClose, option }">
            <a-tag :closable="closable" style="margin-right: 3px" @close="onClose">
              {{ label }}/{{ val }}
            </a-tag>
          </template>
        </a-select>

选择前
image
选择后
image

template的 label 的值被设置为了value的值

from ant-design-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.