摘要:
数据变化的监控经常使用,我们可以先来看一个简单的数据变化监控的例子。例如天气预报的穿衣指数,它主要是根据温度来进行提示的,当然还有其它的,咱们就不考虑了。 html <div id="app"> <span>今日温度{{message}}℃</span> <span>穿衣指数{{message2}} 阅读全文
posted @ 2017-06-04 21:39
xuanPhoto
阅读(294)
评论(0)
推荐(0)
摘要:
html js 阅读全文
posted @ 2017-06-04 21:37
xuanPhoto
阅读(174)
评论(0)
推荐(0)
摘要:
最简单的使用方法,一个数字,每点击一下按钮加1 html js methods中参数的传递 html <div id="app"> <span v-text="number"></span> <button @click="add(10)">add</button> </div> js var vm 阅读全文
posted @ 2017-06-04 21:34
xuanPhoto
阅读(183)
评论(0)
推荐(0)
摘要:
格式化输出结果 我们先来做个读出价格的例子:我们读书的原始数据是price:100 但是我们输出给用户的样子是(¥100元)。 html js html 阅读全文
posted @ 2017-06-04 21:30
xuanPhoto
阅读(155)
评论(0)
推荐(0)
摘要:
propsData 不是和属性有关,他用在全局扩展时进行传递数据,结合自定义属性获取属性值的props一起使用 html js 阅读全文
posted @ 2017-06-04 21:27
xuanPhoto
阅读(272)
评论(0)
推荐(0)
摘要:
html js 阅读全文
posted @ 2017-06-04 16:58
xuanPhoto
阅读(352)
评论(0)
推荐(0)
摘要:
我们把组件编写的代码放到构造器外部或者说单独文件 我们需要先声明一个对象,对象里就是组件的内容。 var zdy = { template:`<div>Panda from China!</div>` } 声明好对象后在构造器里引用就可以了。 components:{ " zdy ": zdy } 阅读全文
posted @ 2017-06-04 16:56
xuanPhoto
阅读(199)
评论(0)
推荐(0)
摘要:
我们在写属性时经常会加入’-‘来进行分词,比如:,那这时我们在props里如果写成props:[‘form-here’]是错误的,我们必须用小驼峰式写法props:[‘formHere’]。 阅读全文
posted @ 2017-06-04 16:52
xuanPhoto
阅读(460)
评论(0)
推荐(0)
摘要:
props定义属性并获取属性值 html js 阅读全文
posted @ 2017-06-04 16:51
xuanPhoto
阅读(397)
评论(0)
推荐(0)
摘要:
组件注册的是一个标签,而指令注册的是已有标签里的一个属性。在实际开发中我们还是用组件比较多,指令用的比较少。因为指令看起来封装的没那么好,这只是个人观点。 阅读全文
posted @ 2017-06-04 16:50
xuanPhoto
阅读(293)
评论(0)
推荐(0)