javascript - Quasar 文件选择器更改 q-file 中所选文件名的文本颜色
问题描述
Quasar File Picker组件用于更改<q-file>
.
选择的文本文件是 test.odt,如何更改它的文本颜色,例如红色?
<q-file
standout
class="registration-field text-red"
bg-color="blue-2"
v-model="registrationNumber"
color="red"
>
<template v-slot:prepend>
<q-icon name="o_insert_photo" size="24px" color="blue" />
</template>
<template v-slot:append>
<div class="attachment text-grey-14">File</div>
</template>
</q-file>
我尝试过使用样式道具color="red"但它不起作用。
有人知道怎么做吗?
解决方案
您可以使用file
插槽并添加text-red
类并且它可以工作。
<q-file
standout
class="registration-field text-red"
bg-color="blue-2"
v-model="registrationNumber"
color="red"
>
<template v-slot:prepend>
<q-icon name="photo" size="24px" color="blue"/>
</template>
<template v-slot:append>
<div class="attachment text-grey-14">File</div>
</template>
<template v-slot:file="{ index, file }">
<div class="ellipsis text-red relative-position">
{{ file.name }}
</div>
<q-tooltip>
{{ file.name }}
</q-tooltip>
</template>
</q-file>
推荐阅读
- c - 如果我们在循环内的 if 语句中使用 return 1 会发生什么?
- python - 如何在抓取页面时形成循环?
- c# - 如何修复 System.AccessViolationException 出现的错误?
- javascript - 如何将数据从 port.on 函数传递到外部变量
- python - 如何合并保存在同一主文件夹中不同子文件夹中的 2000 个 CSV 文件
- html - Bootstrap 导航栏品牌形象垂直居中
- django - 如何在 django 中保存多对多字段
- typescript - Visual Studio Code 中的 TypeScript 运行构建任务失败
- javascript - 按钮单击附加查询字符串
- tensorflow - 如何向 MS COCO 数据集添加一个新类并进行迁移学习以实现更多类?