获取模态 window 中 b-table 单元格的值

Get value of b-table cell in modal window

正在寻求有关如何从模态 window 中的 bootstrap vue table 中提取值的帮助。目前,它生成模态,但是变量 {{ interface_records.interface }} 的内容是空白的。我也尝试过 {{ item.interface }} 也是空白的。

interface_records 有 2 个键 - 界面和模式。

感谢您的宝贵时间

<div v-if="selected.length > 0" v-for="item in selected">
    <b-table 
        id="my-table-interfaces"
        responsive
        sticky-header="550px"
        outlined
        :items="interface_records" 
        :fields="fields_interface"
        :key="interface_records.interface"
    >
        <template #cell(actions)>
            <b-button v-b-modal.modal-confirm @click="showModal = true">        
                <b-icon icon="menu-down" aria-hidden="true"></b-icon> Actions
            </b-button>
        </template>
    </b-table>
    <b-modal id="modal-confirm" ref="modal-confirm" title="Actions" hide-footer centered>
        {{ interface_records.interface }} - Actions
    </b-modal>
</div>

看来这里的问题是您提供给 b-table 的关键道具。尝试按照我刚刚更改 b-table.

的键
<div v-if="selected.length > 0" v-for="(item, itemIndex) in selected">
<b-table 
    id="my-table-interfaces"
    responsive
    sticky-header="550px"
    outlined
    :items="interface_records" 
    :fields="fields_interface"
    :key="itemIndex"
>
    <template #cell(actions)>
        <b-button v-b-modal.modal-confirm @click="showModal = true">        
            <b-icon icon="menu-down" aria-hidden="true"></b-icon> Actions
        </b-button>
    </template>
</b-table>
<b-modal id="modal-confirm" ref="modal-confirm" title="Actions" hide-footer centered>
    {{ interface_records.interface }} - Actions
</b-modal>