Vue 前端开发配置步骤---自学手册
最近要使用Vue 来做互联网前端开发,慢慢把笔记记录下来吧(1) 安装Nodejs ,https://nodejs.org/en/下载安装即可
(2)安装Vue 脚手架
>npm install --global vue-cli/ cnpm install --global vue-cli
(3) 创建项目
vue init webpack vue-plmhome01
(4) cd /d D:/webdev/vue-plmhome01
如果报错,再运行下 npm install
npm run dev
还有一种简单的做法
vue init webpack-simple vue-plmhome02
目录更精简些
新版本安装
卸载老版本
npm uninstall vue-cli -g
安装
npm install -g @vue/cli
vue --version
vue create vue-plmhome02
npm run serve
第一个例子---基本数据的读取
<template><div id="app"><!-- user constant Value --> <h2>my test vue </h2> <br> <!--Use the data value--> {{msg}} <!-- Use object vaue --> <br> <h3> {{obj.name}} : {{obj.Age}}</h3> <br> <!-- interate the arrary --><hr><ul><li v-for="item in nameList" :key="item"> {{ item.message }} </li></ul>
</div></template>
<script>
export default {data(){ return { msg: "hello my first Vue", obj: { name: "Kimi", Age : 33 }, nameList: [ { message: 'Foo' }, { message: '33' } ] }}}</script>
<style>
</style>
数据绑定:
<!-- Bind Attributes -->
<br>
<div v-bind:title="url">
"This is for the url bind"
</div>
<img :src="srcurl" alt="plmhome logo">
<!-- Bind html -->
<div v-html="html">
</div>
<!-- Bind Text-->
<div v-text="msg" v-bind:style="{color:'red'}"></div>
</div>
数据绑定:
<!-- Bind Attributes -->
<br>
<div v-bind:title="url">
"This is for the url bind"
</div>
<img :src="srcurl" alt="plmhome logo">
<!-- Bind html -->
<div v-html="html">
</div>
<!-- Bind Text-->
<div v-text="msg" v-bind:style="{color:'red'}"></div>
</div>
数据绑定:
<!-- Bind Attributes -->
<br>
<div v-bind:title="url">
"This is for the url bind"
</div>
<img :src="srcurl" alt="plmhome logo">
<!-- Bind html -->
<div v-html="html">
</div>
<!-- Bind Text-->
<div v-text="msg" v-bind:style="{color:'red'}"></div>
</div>
数据绑定:
<!-- Bind Attributes -->
<br>
<div v-bind:title="url">
"This is for the url bind"
</div>
<img :src="srcurl" alt="plmhome logo">
<!-- Bind html -->
<div v-html="html">
</div>
<!-- Bind Text-->
<div v-text="msg" v-bind:style="{color:'red'}"></div>
</div>
页:
[1]