动画

<transition name="fade">
<p v-if="show">hello</p>
</transition>


如果你使用一个没有名字的 <transition>,则 v-是这些类名的默认前缀。如果你使用了 <transition name="my-transition">,那么 v-enter 会替换为 my-transition-enter

 

使用axios

安装:cnpm install axios 

使用:

main.js

import axios from 'axios'
Vue.prototype.$ajax = axios

不能使用vue.use(axios),会报错

组件中使用:

this.$http.get('http://cangdu.org:8001/v1/cities?type=group')
                  .then(function(response){
                    console.log(response);
                  })
                  .catch(function(error){
                    console.log(error);
                  });

 事件绑定:

在 Vue 2.0 中,为自定义组件绑定原生事件必须使用 .native 修饰符:

<my-component @click.native="handleClick">Click Me</my-component>

从易用性的角度出发,mintui对 Button 组件进行了处理,使它可以监听 click 事件:

<mt-button @click="handleButtonClick">Click Me</mt-button>

但是对于其他组件,还是需要添加 .native 修饰符。

posted on 2018-07-09 18:53  1183788267  阅读(115)  评论(0)    收藏  举报