Vue,如何在渲染方法中将数据传递给组件
Vue, how do I pass data to component in render method
这是主要的 vue 组件。我想发出 ajax 请求并使用 render 方法将数据传递到我的应用程序组件,它是不同文件中的独立组件。我如何传递这些数据以及如何在我的应用程序组件中检索它。我正在学习 Vue,我知道如何用 <template></template>
做到这一点,但想知道是否可以这样做。
new Vue({
el: '#app',
data: {
data: {}
},
mounted() {
axios.get("http://stag.cyberserge.com:4000/autos").then(res => this.data = res.data)
},
render: h => h(App, this.data)
});
这是主要的 vue 组件。我想发出 ajax 请求并使用 render 方法将数据传递到我的应用程序组件,它是不同文件中的独立组件。我如何传递这些数据以及如何在我的应用程序组件中检索它。我正在学习 Vue,我知道如何用 <template></template>
做到这一点,但想知道是否可以这样做。
new Vue({
el: '#app',
data: {
data: {}
},
mounted() {
axios.get("http://stag.cyberserge.com:4000/autos").then(res => this.data = res.data)
},
render: h => h(App, this.data)
});