我想在VueJs 2中过滤以下内容。
我的组件如下:
<template>
Search <input name="query" v-model="query" class="form-control">
<table class="table">
<thead>
<tr>
<th>User name</th>
<th>User email/th>
<th>Get logs</th>
</tr>
</thead>
<tbody v-for="user in filteredUsers">
<tr>
<td> {{ user.firstname }} </td>
<td> {{ user.lastname }} </td>
<td> <a v-on:click="getUserLogs(user.user_id)">Show</a> </td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
import ConnectionService from '../../components/services/ConnectionService';
const connectionService = new ConnectionService();
export default {
data() {
return {
users: [],
query: '',
betweenDates: {
from: '',
to: ''
},
logs: {},
logsVisibility: false
}
},
created() {
this.getUsers();
},
computed: {
filteredUsers() {
return this.findBy(this.users, this.query, 'lastname')
}
},
methods: {
getUsers() {
this.$http.get(hostname + 'name=person_list&session_id=' + sessionApiId).then(response => {
this.users = connectionService.renderMultipleInstances(response.body);
}, response => {
// error callback
});
},
getUserLogs(id) {
let self = this;
axios.post('/logs/get_user_logs', {
userId: id,
}).then(function (response) {
self.logs = response.data;
self.logsVisibility = true;
console.log(response.data);
});
},
findBy(list, value, column) {
return list.filter(function (item) {
return item[column].includes(value)
})
}
}
}
</script>
我有以下数据来过滤它:
users:Array[4095]
0:Object
firstname:"Анастасия"
id:206
lastname:"Никифорова"
middlename:"Юрьевна"
user_id:192
1:Object
firstname:null
id:3362
lastname:null
middlename:null
user_id:2046
...
错误如下:
[Vue警告]:渲染功能出错:&#34; TypeError:无法读取属性&#39;包含&#39; of null&#34;
答案 0 :(得分:2)
1:对象if obj.descriptors.dtype == 'uint8':
# ORB creates binary descriptors, so we use LSH indexer
FLANN_INDEX_TYPE = 6
elif obj.descriptors.dtype == 'float32':
# SIFT creates float descriptors, so use KD-Tree indexer
FLANN_INDEX_TYPE = 0
index_params = dict(algorithm=FLANN_INDEX_TYPE,
table_number=6, # 12
key_size=12, # 20
multi_probe_level=1) # 2
search_params = dict(checks=50) # or pass empty dictionary
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(obj.descriptors, img.descriptors, k=2)
。它会导致您的错误
您可以在返回前添加行
bf = cv2.BFMatcher()
matches = bf.knnMatch(obj.descriptors, img.descriptors, k=2)
或
for m, n in matches:
if m.distance < 0.75 * n.distance:
obj_m.append(obj.keypoints[m.queryIdx].pt)
img_m.append(img.keypoints[m.trainIdx].pt)
答案 1 :(得分:0)
我有一个类似的问题需要修复它我用一个&#39;替换我的对象中的每个空值。 &#39; (空字符串)