【问题标题】:Getting the q-item-label text获取 q-item-label 文本
【发布时间】:2020-02-06 10:21:30
【问题描述】:

我有这个使用 Quasar/VueJS 的代码。我想要做的是根据选择的<q-item-label>更新下拉文本标签(keyDropDownLabel)。

因此,在下面的示例中,我希望 newLabelGoesHere 部分为 Key 1/2/3,具体取决于单击的内容。

<q-btn-dropdown stretch flat :label="keyDropDownLabel">
  <q-list>
    <q-item v-for="n in 3" :key="`x.${n}`" clickable v-close-popup tabindex="0">
      <q-item-section @click="keyDropDownLabel = 'newLabelGoesHere'">
        <q-item-label>Key {{ n }}</q-item-label>
        <q-item-label caption>1234567890</q-item-label>
      </q-item-section>
    </q-item>
  </q-list>
</q-btn-dropdown>

有人帮忙吗??

【问题讨论】:

    标签: node.js vue.js quasar-framework


    【解决方案1】:

    只需修改 q-item-section click 方法如下:

    <q-item-section @click="keyDropDownLabel('Key'+n)">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-25
      • 1970-01-01
      相关资源
      最近更新 更多