vuex的state无法监听二级数据变化,解决:
state.car.push({})//强制触发state的数据监听
state.car.pop()
vuex与input的双向绑定:
https://vuex.vuejs.org/zh/guide/forms.html
原生的js获取索引位置:
<div id='father'>
<p class="p1">1</p>
<p class="p2">2</p>
<p class="p3">3</p>
</div>
var op = document.querySelectorAll('p');
var op2 = document.querySelectorAll('p')[2];
var index = [].indexOf.call(op, op2);
console.log(index); //2
作者:chengfengwang
链接:https://www.jianshu.com/p/b1a8d669b849
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。