Vue.js如何在组件中获取自定义对象

时间:2018-11-02 13:53:44

标签: javascript vue.js vue-component

我想使用自定义对象代替ProcessStartInfo startInfo = new ProcessStartInfo { FileName = path ,Arguments = string.Join(" ", Args) ,UseShellExecute = false ,CreateNoWindow = true ,RedirectStandardOutput = true ,RedirectStandardError = true //,RedirectStandardInput = true //This leads the process to crash! }; Process myProcess = new Process { StartInfo = startInfo }; myProcess.Start(); /*...*/ public void SendInput(string input) { //TODO: see how to send input to process' console int result = SendMessage(myProcess.Handle, 0x000C, 0, input + '\n'); // Not working :( }

例如

vue-meta

如何获取自定义定义对象<template> ..... </template> <script> export default { aboutMe: {} } </script>

PS:但是没有aboutMedata

谢谢!

1 个答案:

答案 0 :(得分:1)

该对象在$options属性中可用:

mounted() {
  console.log(this.$options.aboutMe)
}

<template>
   <span> {{ $options.aboutMe }} </span>
</template>

但是通常您希望将对象添加到data

data: () => ({
  aboutMe: {}
})

然后您可以使用{{ aboutMe }}this.aboutMe