一个方法中引入另一个方法
this.$options.methods.test2();
new Vue({
el: '#app',
data: {
test:111,
},
methods: {
test1:function(){
alert(this.test)
},
test2:function(){
alert("this is test2")
alert(this.test) //test3调用时弹出undefined
},
test3:function(){
this.$options.methods.test2();//在test3中调用test2的方法
}
}
})
created与mounted
created:在模板渲染成html前调用,即通常初始化某些属性值,然后再渲染成视图。
mounted:在模板渲染成html后调用,通常是初始化页面完成后,再对html的dom节点进行一些需要的操作
循环
<template v-for="item in role_list">
<tr class="lh40">
<td>{{item.role_name}}</td>
<td></td>
<td></td>
<td>
<router-link to="/new-staff">
<span>添加新员工</span>
</router-link>
<span> | </span>
<span>编辑</span>
<span> | </span>
<span>删除</span>
</td>
</tr>
</template>
<select class="lh30 ml5" v-model="value">
<option v-for="item in role_list" :value="item.role_id">{{item.role_name}}</option>
</select>
el-input设置高度
<el-input :rows="6" type="textarea" v-model="demandDesc" style="width:60%;" class="mtb10 db" placeholder="需求描述"></el-input><br/>
#通过rows去设置高度