我已经尝试过了,但我无法解决问题。从我在其他地方读到的内容来看,传递给子组件的变量会像undefined数据在父组件中可用之前一样发送。
请参阅此处以供参考:
<template>
<div id="app">
<child :parentData="data.message"/>
</div>
</template>
<script>
import Child from "./components/Child";
export default {
name: "App",
components: {
Child
},
computed: {
quote() { return 'Better late than never' }
},
data() {
return {
data: { message: this.quote } ,
thisWorks: { message: "You can see this message if you replace what is passed to the child" }
};
}
};
</script>
Run Code Online (Sandbox Code Playgroud)
然后在孩子身上:
<template>
<div>
<h1>I am the Child Component</h1>
<h2> {{ …Run Code Online (Sandbox Code Playgroud) 在我的 vue-cli3 项目中,当我运行构建命令时,我会得到通常的 index.html + 3 个文件夹(css、js、img)。
是否可以以某种方式将 img 文件夹的名称更改为“images”?
我想我必须在 vue.config.js 中添加一些内容来指示 webpack,但我找不到任何相关信息。
感谢您的指点。