【问题标题】:How to make add hyperlink to a row of items in Quasar?如何为 Quasar 中的一行项目添加超链接?
【发布时间】:2020-01-22 18:12:49
【问题描述】:

我有一个 Quasar 表,其中有 5 列。在五列中,我希望第一列具有指向我从 api 获得的值的超链接。

这是我的 Blade.php 代码 -

colModel:[
{name:'name',index:'name', align:'center', sortable:false,  formatter: 'showlink', width:211, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"' }, searchoptions:{sopt:["cn","eq","nc","bw"]}},
{name:'in',index:'in', align:'center', sorttype:'date', datefmt:'Y-m-d H:i:s', searchoptions:{sopt:["cn","eq","nc","bw"]}},
{name:'out',index:'out', align:'center', sortable:true, searchoptions:{sopt:["cn","eq","nc","bw"]}},
{name:'in_comments',index:'in_comments', align:'center',  sorttype:'text', width:211, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"' }, searchoptions:{sopt:["cn","eq","nc","bw"]}},
{name:'out_comments',index:'out_comments', align:'center', sorttype:'text', width:211, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"' }, searchoptions:{sopt:["cn","eq","nc","bw"]}}
]


这是我的 Vue 代码 -

      visibleColumns: ['name', 'in', 'out', 'in_comments', 'out_comments'],
      columns: [
        { name: 'name', align: 'center', label: 'Name', field: 'name', sortable: true },
        { name: 'in', label: 'In', field: 'in', sortable: true },
        { name: 'out', label: 'Out', field: 'out', sortable: true },
        { name: 'in_comments', label: 'in comments', field: 'in_comments' },
        { name: 'out_comments', label: 'out comments', field: 'out_comments' },
      ],

名称应该用这样的超链接包裹 - 名称

我可以知道可以做些什么来实现这一目标吗?

【问题讨论】:

    标签: html vuejs2 qtableview quasar-framework quasar


    【解决方案1】:

    您也可以只自定义一个特定的列。此槽的语法为body-cell-[name],其中[name] 应替换为用作行键的每一行的属性。

    示例 -

    <template v-slot:body-cell-name="props">
            <q-td :props="props">
              <div>
                <a href="https://quasar.dev/vue-components/table#QTable-API" />
              </div>
            </q-td>
          </template>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 2017-02-20
      • 2011-11-22
      • 2018-06-18
      • 2010-10-06
      • 2020-06-04
      相关资源
      最近更新 更多