<template>
<div class="hello">
<h1>{{ msg }}</h1>
<div>{{data1}}</div>
<ul>
<li v-for="(item, index) in list">
{{item.name}} - {{item.price}} - {{index}}
</li>
</ul>
<!-- <p v-text="hello"></p>
<p v-html="hello"></p>
{{ num + 1}} <ul>
<li v-for="item in list" v-text="item.name + '-' + item.price">
</li>
</ul>
<ul>
<li v-for="(item, index) in objList">
{{index + ":" + item}}
</li>
</ul> -->
<!-- <componentA v-for="(item, key) in objList" >
</componentA> -->
<button v-on:click="addItem">addItem</button>
<a v-bind:href="linlk" :title="linlk">to baidu</a>
<a class="ccc" v-bind:class = "classStr"> to calss</a>
<a class="ccc" v-bind:class = "[classRed,{'blue':blueSwitch}]"> 控制class</a>
<button v-on:click="clickBlue">clickBlue</button>
<p v-if="blueSwitch">isPartA</p>
<p v-show="blueSwitch">isPartB</p> </div>
</template>
<script>
import Vue from 'vue'
//引入组件
import componentA from './a'
export default {
components:{
componentA:componentA
},
name: 'HelloWorld',
data() {
return {
msg: ' helloWord ',
hello: '<span> word</span>',
num: 1,
data1:'data1',
list: [{
name: 'apple',
price: 64
},
{
name: 'banana',
price: 25
}
],
objList:{
name:'tong',
possword:'123456465',
id:'vasd',
group:'01'
},
linlk:'http://www.baidu.com',
classStr:['classStr','classStr1'],
classRed:['classRed'],
blueSwitch:true,
}
},
methods:{//事件
addItem (){
this.list.push({
name :'pinaapple',
price:2564
});
console.log(this.list);
Vue.set(this.list,1,{
name :'changeAapple',
price:111
}); },
clickBlue (){
if(this.blueSwitch == false){
this.blueSwitch = true;
return false;
}
if(this.blueSwitch == true){
this.blueSwitch = false;
return false;
}
}
}
} </script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
/* display: inline-block; */
margin: 0 10px;
}
a {
color: #42b983;
}
.blue {
color: blue;
}
</style>

vue 起步_code的更多相关文章

  1. Vue起步

    Vue起步 Vue.js是什么 Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式javascript框架.与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用. ...

  2. vue 起步走 --“安装篇”

    在说明之前,溶解得在这说一句 ,菜鸟开始安装这些东西真是不容易,各种疯狂的百度,搜索.(找的我眼泪都快流下来了),不说废话,开始正经. 第一步:环境的搭建 : vue推荐开发环境: Node.js: ...

  3. 初识vue——起步

    一.目录结构: 我们经常使用的是以下几个目录: 1.assets:静态资产文件:在vue组件中,所有组件中,所有模板和CSS都会被vue-html-loader和css-loader解析,并查找资源u ...

  4. vue起步和模板語法

    vue構造器里有哪些內容: var a=new Vue({}) 模板語法: 文本插值: html: html的屬性里的值應該使用v-bind: 表達式: 指令; 參數:v-bind,v-on 雙向用戶 ...

  5. vue 起步

    vue 官网 目前最火的前端框架当属Vue.js了,很多使用过vue的程序员这样评价它,“vue.js兼具angular.js和react.js的优点,并剔除了它们的缺点”.授予了这么高的评价的vue ...

  6. 【Vue起步-Windows】N01:环境安装

    本文基于“vue.js安装过程(npm安装)”文章内容及个人出现的问题整合而成. 1.安装npm环境 在Node官网中下载最新的windows版msi安装包,并默认所有安装选择. 2.查看npm安装版 ...

  7. webpack+vue起步

    本文基于vue1.x 基于vue2.x&webpack2.x请移步至 Vue2.x踩坑与总结Webpack2.x踩坑与总结 记得第一次知道Vue.js是在勾三股四大大的微博,那时候他开始翻译v ...

  8. vue 起步(一)

    准备 安装nodejs(下载),Windows 安装包(.msi) npm相关 打开cmd查看npm版本, npm -v,如果没有安装npm,执行npm install npm -g进行安装 查询当前 ...

  9. 第二章、 Vue 起步

    2-2.编写hello world 首先创建vue实例,然后实例接收一些配置项,el表示实例负责管理的区域,data表示区域内的数据 两秒后内容变为bye world 其中app表示实例对象,$dat ...

随机推荐

  1. Django项目部署(阿里云)(1)--基本功能实现

    新博客地址:http://muker.net/django-server.html 手头需要部署一个Django项目,前面的博客也因为偷懒也没有部署,这里记录一下部署过程.ps:其实网上比较靠谱的说明 ...

  2. object references an unsaved transient instance【异常】

    [异常提示] TransientObjectException: object references an unsaved transient instance -save the transient ...

  3. C#中 this关键字 四种用法

    /// <summary> /// 主程序入口 /// </summary> /// <param name="args"></param ...

  4. 《DSP using MATLAB》示例Example7.6 Type-3 Linear-Phase FIR

    代码: h = [-4, 1, -1, -2, 5, 0, -5, 2, 1, -1, 4]; M = length(h); n = 0:M-1; [Hr, w, c, L] = Hr_Type3(h ...

  5. 分享Win7 将svn增加系统服务并成功启动的方法

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/default7/article/details/32728717 依照网上搜索到的方法,结果一直提示 ...

  6. cocos2dx ScrollView的用法

    http://blog.csdn.net/u014096244/article/details/21525789 http://bbs.9ria.com/thread-199305-1-1.html ...

  7. linux主次设备号【转载】

    一个字符设备或者块设备都有一个主设备号和次设备号.主设备号和次设备号统称为设 备号.主设备号用来表示一个特定的驱动程序.次设备号用来表示使用该驱动程序的各 设备.例如一个嵌入式系统,有两个LED指示灯 ...

  8. About HDFS blocks

    一个磁盘有它的块大小,代表着它能够读写的最小数据量.文件系统通过处理大小为一个磁盘块大小的整数倍数的数据块来运作这个磁盘.文件系统块一般为几千字节,而磁盘块一般为512个字节.这些信息,对于仅仅在一个 ...

  9. Unit08: Spring集成mybatis

    Unit08: Spring集成mybatis 1. Spring集成mybatis (1)方式一 step1. 导包. spring-webmvc,mybatis,mybatis-spring, o ...

  10. TCP/IP网络编程系列之三(初级)

    TCP/IP网络编程系列之三-地址族与数据序列 分配给套接字的IP地址和端口 IP是Internet Protocol (网络协议)的简写,是为首发网络数据而分配给计算机的值.端口号并非赋予计算机值, ...