【发布时间】:2021-02-17 21:47:43
【问题描述】:
v-input-text 的标签在右边。我想把它放在左边而不使用css,这实际上应该是默认的。从documentation 我可以看到左侧是默认的。我已经尝试了几个 Vuetify 文档的示例,它们都给了我相同的结果。
代码是从文档中复制/粘贴的。在我看来,如此简单的事情不应该成为问题。我已经为此苦苦挣扎了一段时间。我已经尝试在不同的浏览器中运行几个示例:Opera、Microsoft Edge、Firefox。
这是您可以找到的代码here:
<template>
<v-form>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="message"
outlined
clearable
label="Message"
type="text"
>
<template v-slot:prepend>
<v-tooltip
bottom
>
<template v-slot:activator="{ on }">
<v-icon v-on="on">
mdi-help-circle-outline
</v-icon>
</template>
I'm a tooltip
</v-tooltip>
</template>
<template v-slot:append>
<v-fade-transition leave-absolute>
<v-progress-circular
v-if="loading"
size="24"
color="info"
indeterminate
></v-progress-circular>
<img
v-else
width="24"
height="24"
src="https://cdn.vuetifyjs.com/images/logos/v-alt.svg"
alt=""
>
</v-fade-transition>
</template>
<template v-slot:append-outer>
<v-menu
style="top: -12px"
offset-y
>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs"
v-on="on"
>
<v-icon left>
mdi-menu
</v-icon>
Menu
</v-btn>
</template>
<v-card>
<v-card-text class="pa-6">
<v-btn
large
flat
color="primary"
@click="clickMe"
>
<v-icon left>
mdi-target
</v-icon>Click me
</v-btn>
</v-card-text>
</v-card>
</v-menu>
</template>
</v-text-field>
</v-col>
</v-row>
</v-container>
</v-form>
</template>
结果:
【问题讨论】:
-
github.com/vuetifyjs/vuetify/issues/1782 和 github.com/vuetifyjs/vuetify/issues/4552 提出了一个关于此的问题。不确定反向道具是否能解决您的问题。
-
反向对我不起作用。您提到的第一个问题只是文本的对齐,这对我来说很好。它在右边。第二个问题发生在使用 reverse 属性时,我没有。我可能会在我的项目中不再使用 Vuetify,这样简单的事情就不是问题了。
-
"我想放在右边不使用css" 好像不支持这个功能。如果它可以满足您的需求,为什么不使用添加几行 CSS 呢?
-
你为什么不能使用
labelslot呢? -
我对我的问题的解释有误。请查看更新版本。
标签: css vue.js vuetify.js