[Vue 警告]:渲染错误:“TypeError: object is undefined”

艾哈迈德·纳瓦兹·汗

<script>
        const app = new Vue({
            el: '#app', 
            data:{
                results:{}
            },
            mounted()
            {
                axios.get('{{ route('request.data') }}').then(response=>this.results = response.data)
            }
        });
    </script>
<span class="company-value" v-text="results.request_stats.new"></span>

正如标题一样,这是我得到的错误。但是当我console.log(object)值存在并且它不为空时。那么这个错误的意义何在

注意:object=results.request_stats

尼克莱什·劳特

您必须声明并分配一些值,例如{}[]绑定 ,否则您将收到 Undefined 错误request_stats.new

const app = new Vue({
            el: '#app', 
            data:{
                results:{request_stats:{}},
                loading:true
            },
            mounted()
            {
              var vm = this;
               setTimeout(function(){ 
                vm.loading = false;
                vm.results.request_stats.new = "Niklesh Raut";
               }, 1000);
            }
        });
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<div id="app">
<div>
<span class="company-value" v-text="results.request_stats.new"></span>
<div v-show="loading">loading...</div>
</div>
</div>

没有分配,这是给出错误

const app = new Vue({
            el: '#app', 
            data:{
                results:{},
                loading:true
            },
            mounted()
            {
              var vm = this;
               setTimeout(function(){ 
                vm.loading = false;
                vm.results.request_stats.new = "Niklesh Raut";
               }, 1000);
            }
        });
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<div id="app">
<div>
<span class="company-value" v-text="results.request_stats.new"></span>
<div v-show="loading">loading...</div>
</div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

[Vue 警告]:渲染错误:“TypeError: undefined is not an object (evaluating 'this.$store.state')”

[Vue 警告]:渲染错误:在 vue 中使用数据表时出现“TypeError: Cannot read properties of undefined (reading 'length')”错误

[Vue警告]:渲染错误:“ TypeError:无法读取null的属性'paid'”

[Vue警告]:渲染错误:“ TypeError:_vm.selectedProductDetails为空”

[Vue 警告]:渲染错误:“TypeError:无法读取 null 的属性 'xxx'”

Vue 警告:渲染错误:“TypeError:路由未定义”

字典错误 - TypeError: undefined is not an object

渲染错误:“ TypeError:无法读取未定义的属性'名称'” [Vue警告]

[Vue警告]:渲染错误:“ TypeError:将圆形结构转换为JSON

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'xxx'”

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'shipperid'”

[Vue警告]:渲染错误:“ TypeError:_vm.activity.activity未定义”

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'名称'”

[Vue警告]:渲染错误:“ TypeError:state.actionInfo.find不是函数”

VueJs [Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'title'”

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'organization'”

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'sex'”

[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'correct_answer'”

[Vue 警告]:渲染错误:“TypeError:无法读取未定义的属性‘BTC’”

[Vue 警告]:渲染错误:“TypeError:无法读取未定义的属性‘类型’”

[Vue 警告]:渲染错误:“TypeError:无法读取未定义的属性‘文本’”

Vue.js-我该如何解决[Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性'port'”?

为什么我面临错误 [Vue 警告]:渲染错误:“TypeError:无法读取未定义的属性‘名称’”

为什么会出现此错误“TypeError: undefined is not an object”

了解控制台错误“TypeError: undefined is not an object”和“Uncaught TypeError: Cannot read property '0' of undefined”

【Vue.js】想「渲染时出错:"TypeError: Cannot read property 'title' of undefined" 」

TypeError:undefined不是对象(评估'object ['body']')

Vue 2 Mixin 在 v-for 中无法正常工作“[Vue 警告]:渲染错误:“TypeError:无法读取未定义的属性‘discountCalc’””

TypeError:Object(...)不是Vue中的函数