主要使用原先的index.js和header.js来进行演示 1 修改index.js中的代码如下 2 回到子组件header.js,修改里面的代码 3保存运行 npm run start 运行结果如下