Vue.js 试图使用道具将数据传递给全局对象,但无法';无法获取要显示的数据

Vue.js 试图使用道具将数据传递给全局对象,但无法';无法获取要显示的数据,vue.js,components,Vue.js,Components,我试图将数据从组件传递到全局对象。我的组件正在工作,但作者未正确显示。谁能告诉我哪里做错了 let store = { _author: 'Johnnie Walker', }; Vue.component('post', { template: '#post-template', props: ['title', 'author', 'content'] }); var vm = new Vue({ el: '#app', data: { author: sto

我试图将数据从组件传递到全局对象。我的组件正在工作,但作者未正确显示。谁能告诉我哪里做错了

let store = {
  _author: 'Johnnie Walker',
};

Vue.component('post', {
  template: '#post-template',
  props: ['title', 'author', 'content']
});

var vm = new Vue({
  el: '#app',
  data: {
    author: store,
    title: 'Aging Your Own Whisky',
    content: 'A bunch of steps and a whole lot of content'
  }
});

存储
是一个对象,其中有一个名为
\u author
的属性

您的
数据
应该-

data: {
  author: store._author,
  title: 'Aging Your Own Whisky',
  content: 'A bunch of steps and a whole lot of content'
}

author:store.\u author?这是您的一个分叉版本,它具有正确的语法,可用于深入到存储对象文本的
\u author
属性。