报错:
- index.umd.min.js:1 [system] TypeError: Cannot set property 'title' of undefined
at Function.complete (info.vue:14)
at index.umd.min.js:1
at Object.A [as callback] (index.umd.min.js:1)
at v (index.umd.min.js:1)
at XMLHttpRequest._.onload (index.umd.min.js:1) - 问题:但是的data中已经定义了title啊
-
代码:
<template>
<view class="dd">
<view class="title">{{title}}</view>
<view class="content">{{content}}</view>
</view>
</template>
<script>
export default {
onLoad: (e) => {
uni.request({
url: 'https://unidemo.dcloud.net.cn/api/news/36kr/'+e.newsid,
complete: (res) => {
this.title=res.data.title
this.content=res.data.content
}
});
},
data() {
return {
title: '',
content:""
};
}
}
</script>
<style>
</style>
m***@qq.com (作者)
哦问题解决了,谢谢
2019-03-20 15:31