data() { return { // 传到后端的主表的查询条件 query_dict: {}, // 传到后端的特殊标记表的查询条件 query_dict_mark: {}, // 问题状态多选查询的值 query_values_problem_state: [], // 模块多选查询的值 query_values_module_name: [], // 其他(特殊标记)多选查询返回的值(符合特殊标记的问题id列表) problem_id_list: [], // 传给table子组件的后端返回的数据 data_list: [], test:'test1', username: this.$store.getters.name, button_list_mark: [ { 'value': '我创建的', 'query_field': 'creat_by', 'test':this.test, 'query_value': this.username }, { 'value': '我负责的', 'query_field': 'person_in_charge', 'query_value': this.username, 'test':'test2', }, { 'value': '我参与的', 'query_field': 'participant', 'query_value': this.username }, { 'value': '我收藏的', 'query_field': 'favorite', 'query_value': this.username } ], } }, 为何this.test和this.username中没有值
时间: 2024-02-05 19:03:17 浏览: 81
如果在data()函数中'this.test'和'this.username'没有值,那么可能是以下原因:
1. 在当前上下文中没有定义'this.test'和'this.username'的值;
2. 在当前上下文中,'this.test'和'this.username'的值为null或undefined;
3. 代码中使用了异步操作,导致'this.test'和'this.username'的值还未被赋值。
需要查看代码执行的具体情况才能确定原因。可以在代码中加入console.log语句,输出'this.test'和'this.username'的值,帮助定位问题。
相关问题
vue中的代码data() { return { // 传到后端的主表的查询条件 query_dict: {}, // 传到后端的特殊标记表的查询条件 query_dict_mark: {}, // 问题状态多选查询的值 query_values_problem_state: [], // 模块多选查询的值 query_values_module_name: [], // 其他(特殊标记)多选查询返回的值(符合特殊标记的问题id列表) problem_id_list: [], // 传给table子组件的
代码中似乎没有问题,这是一个Vue组件的data选项,其中包含了一个对象。这个对象中包含了多个属性和对应的值,这些值会在组件的生命周期中被使用。这些值可能是在组件实例化时被定义和赋值的,也可能是在后续的操作中被修改。由于没有看到完整的代码,无法判断'this.test'和'this.username'的值是否存在问题。如果你有其他问题,可以提出来,我会尽力帮助你解决。
<MySearch_select :query_dict="query_dict" :label_title='"工厂"' :field_name='"factory"' :button_list="['佛山']"> </MySearch_select> button_list如何传递1个数组
可以将数组作为一个变量传递给组件,在组件中使用这个变量作为按钮列表。例如:
```
<MySearch_select :query_dict="query_dict" :label_title='"工厂"' :field_name='"factory"' :button_list="myButtonList"> </MySearch_select>
<script>
export default {
data() {
return {
myButtonList: ['佛山', '广州', '深圳']
}
}
}
</script>
```
这样就可以传递一个包含多个按钮的数组给组件。注意,这里的 `myButtonList` 是在组件的 `data` 中声明的变量。
阅读全文
相关推荐
















