vue目录结构熟悉

 给项目的入口文件做点小改变: 【补充:编辑器建议使用vscode,我还没装,暂时先用phpstorm】 打开 APP.vue 文件,代码如下(解释在注释中) <!-- 展示模板 --> <te...

 给项目的入口文件做点小改变:

【补充:编辑器建议使用vscode,我还没装,暂时先用phpstorm】

打开 APP.vue 文件,代码如下(解释在注释中)

<!-- 展示模板 -->
<template>
  <div id="app">
    <img src="./assets/logo.png">
    <hello></hello>
  </div>
</template>

<script>
//导入组件
import Hello from "./components/Hello"

export default {
  name: 'app',
  components:{
    Hello
  }
}
</script>

<!-- 样式代码 -->
<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

修改 src/components/Hello.vue

<template>
    <div class="hello">
        <h1>{{ msg }}</h1>
    </div>
</template>

<script>
export default{
    name:"hello",
    data(){
        return {
            msg:"cyy要学习vue啦~"
        }
    }
}
</script>

重新打开页面 http://localhost:8080/,一般修改后会自动刷新,显示效果

  • 发表于 2020-02-28 16:02
  • 阅读 ( 127 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除