我正在使用 Vue 并尝试进行实时搜索。但是在更新搜索内容时,它不会更新。
在开发工具中检查时,数据确实会在数组中更新。但是 DOM 不会更新。
模板
<div class="dropdown">
<input type="text" v-model="input" placeholder="Search" @keyup="searching" data-toggle="dropdown">
<span class="caret"></span>
<ul class="dropdown-menu">
<li v-for="(data,index) in availSearchData" :key="index">
<a href="#">{{data.name}}</a>
</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
方法
searching() {
if (this.input) {
let url = this.domain + "search";
axios
.get(url, {
params: {
table: this.table,
data: this.input
}
})
.then(res => {
this.availSearchData = [];
res.data.forEach(doc => {
this.availSearchData.push(doc);
});
});
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道我哪里做错了。如果可能,请帮忙。
我想将<th>Vuetify table 中的字体大小增加到 20px v-data-table。但它保持在 12px。
我试过这个:
table.v-table thead tr th {
font-size: 20px!important;
}
Run Code Online (Sandbox Code Playgroud)
这是我的数据表:
<v-data-table
:headers="headers"
:items="myjson"
class="elevation-1"
>
<template v-slot:items="props">
<td>{{ props.item.ApplicationType }}</td>
</template>
</v-data-table>
Run Code Online (Sandbox Code Playgroud)
我希望 thead 的字体大小为 20px。但是在检查时它保持在 12px。
我想使用Vuetify 的自动完成功能,但我在那里遇到了问题,因为在我的网站上,我有一个外部 divposition: relative的下拉部分,即autocompelete,它position: absolute不是将自己附加到 底部input而是随机位置。
自动完成有一个道具attach,Specifies which DOM element that this component should detach to. Use either a CSS selector string or an object reference to the element.所以我想我使用它并将其设置为我的输入类。
这有效,但它会在控制台中引起警告
[Vuetify] Unable to locate target v-autocomplete
found in
---> <VMenu>
<VAutocomplete>
<VCard>
<VApp>
<Root>
Run Code Online (Sandbox Code Playgroud)
这是我复制控制台警告的链接。
我正在使用Vuetify的1.5.6版本(在Laravel 5.8后端和VueJs 2.5.17上感到沮丧),并将文档中的DatatableComponent示例之一(https://vuetifyjs.com/en/components/data-tables)放入我的应用程序采用了我的要求。但是,我没有做很多更改,但是当它在我的应用程序中运行时,每次datatable呈现时都会出现以下错误:
属性或方法“ props”未在实例上定义,但在渲染期间被引用。通过初始化属性,确保该属性在data选项中或对于基于类的组件都是反应性的。请参阅:https : //vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties。在TransactionComponent中
当我在Codepen上尝试完全相同的代码时,它可以正常工作:https ://codepen.io/anon/pen/Rdjjgx
在我的本地应用程序上,我具有以下结构(与上述示例的唯一区别是,组件本身是通过VueJs路由器而不是通过模板加载的):
TransactionComponent.vue:
<template>
<v-card>
<v-card-title>
Transaktionen
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="search"
label="Suche..."
single-line
hide-details
></v-text-field>
</v-card-title>
<v-data-table
:headers="headers"
:items="transactions"
:search="search">
<template v-slot:items="props">
<td>{{ props.item.date }}</td>
<td class="text-xs-right">{{ props.item.type }}</td>
<td class="text-xs-right">{{ props.item.remark }}</td>
<td class="text-xs-right">{{ props.item.plane }}</td>
<td class="text-xs-right" v-bind:class="{'color':(props.item.fee > 0 ? '#0F0' : '#F00')}">{{ props.item.fee }}</td>
</template>
<v-alert v-slot:no-results :value="true" color="error" icon="warning">
Ihre Suche für "{{ search }}" brachte keine Ergebnisse.
</v-alert> …Run Code Online (Sandbox Code Playgroud) 我想将v-switch元素水平居中v-flex,我已经在这里尝试过:vuetify center items into v-flex,但它似乎不适用于该v-switch元素。
我是否将它包装在 div 类中,如下所示:
<v-flex xs12 md2 >
<div class="text-xs-center">
<v-switch
@click="someFunction()"
label="Some Label Name"
color="black"
value="secondary"
hide-details
></v-switch>
</div>
</v-flex>
Run Code Online (Sandbox Code Playgroud)
或者我直接在以下内容中使用该类v-flex:
<v-flex xs12 md2 text-xs-center>
这不起作用。使用其他类也class="justify-center"行不通。
这是一个codepen,所以你可以看到问题
正确的做法是什么?
我刚刚将 DLL 文件包含到我的项目中,并使用返回List<Tuple>. 我最近才意识到ValueTupleC# 7 中的数据类型,并想使用它来代替返回的普通元组。我知道我可以循环并手动进行转换,但是我想尽可能避免这样做,并且想知道是否有人知道将 Tuple 转换为 ValueTuple 的简写方法?如果我无知并且这是不可能的,那么如果有人能让我意识到实现这种转换的最有效方法,我将不胜感激。
我寻找了一种.ToValueTuple()方法,并在返回列表的函数上使用了基本的转换,但没有任何乐趣。
尝试时:
List<(string entityName, int min, int average, int max)> tupTest = trs.GetEntityStats();
Run Code Online (Sandbox Code Playgroud)
我收到错误:
无法将源类型“System.Collections.Generic.List>”转换为目标类型“System.Collections.Generic.List<(string entityName, int min, intaverage, int max)>”
vue.js ×5
vuetify.js ×4
.net ×1
axios ×1
c#-7.0 ×1
css ×1
datatable ×1
dom ×1
flexbox ×1
html ×1
jquery ×1
tuples ×1
valuetuple ×1
vue-router ×1