我想使用 autocomplete来自 Vuetify,我在那里面临问题,因为在我的网站上,我有一个外部 div position: relative
autocompelete
的下拉部分,即 position: absolute
,不是附加到 input
的底部,而是附加到随机位置。
Autocomplete 有一个属性 attach
,它 指定这个组件应该分离到哪个 DOM 元素。使用 CSS 选择器字符串或对元素的对象引用。
所以我想我使用它并将其设置为我的输入类。
这可行,但会在控制台中引起警告
[Vuetify] Unable to locate target v-autocomplete
found in
---> <VMenu>
<VAutocomplete>
<VCard>
<VApp>
<Root>
Here我重现控制台警告的链接。
最佳答案
如果您没有在 App.vue 中使用 v-app
组件,请确保将 data-app
属性添加到 div
中App.vue 中的 id app
。
结果会像下面这样:
<template>
<div id="app" data-app>
.... All components, routers, views here ...
</div>
</template>
关于vue.js - Vuetify 在 v-autocomplete 上使用附加时无法定位目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55421235/