我要显示的api中的数据不起作用
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub">
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:id="@+id/layoutId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible">
<Button
android:id="@+id/closeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Close"/>
<Button
android:id="@+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/closeButton"
android:text="Next"/>
<EditText
android:id="@+id/findBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/nextButton"
android:hint="Enter search keyword here."
android:singleLine="true"/>
</RelativeLayout>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="match_parent"/>
</LinearLayout>
显示,没有任何数据
[{"gameID":1368656,"gameReultTime":"2019-03-01 01:08:25","gameReult":2763.33,"totalPayout":1.98,"totalbet":100}]
JS
<tr v-for="data in dataresults">
<td>{{data.gameID}}</td>
<td> {{ data.totalbet }}</td>
<td>{{data.gameReult}}</td>
<td>{{data.totalPayout}}</td>
</tr>
答案 0 :(得分:1)
请尝试将您的代码移至mounted
生命周期挂钩:
data() {
return {
dataresults: [],
};
},
mounted() {
axios
.get("api/getoutcome")
.then((response) => {
this.dataresults = response.data
})
.catch(function(error) {
console.warn(error);
});
}