Vue.js项目1:hello,vue!
一、新建一个webpack应用
1、打开Windows PowerShell
2、进到你需要存储应用的文件夹目录(注意:文件目录不要带有中文)
3、新建一个名为hellovue的webpack应用,出现一下黄色的提示回车即可
vue init webpack hellovue
完成依赖安装
4、进到hellovue目录,并且运行webpack应用
cd hellovue
npm run dev
5、在浏览器中输入:localhost:8080看运行结果
二、在webpack模板基础上编写hellovue应用
1、用subline text3打开应用所在的文件夹
2、打开hellovue-src-App.vue
3、修改Helloword.vue
<template>
<div class="hello">
<input type="text" v-model="msg" placeholder="请输入文字">
<h1>hello,{{ msg }}</h1>
</div>
</template>
<script>
export default {
name:'HelloWorld',
data () {
return {
msg: ' '
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1{
font-weight: normal;
}
</style>
4、查看运行结果:
6.在输入框输入:Vue,再查看结果!
Try to be yourself!