用js怎么动态插入行

用js怎么动态插入行,第1张

function appendTable(jsonObj) { var tabL = gel("tbList")var taRow = tabL.rows//tabL 对象的行集合 //这里应该是判断有几行,取 length if (taRow.length >1) { //原先是不满足条件,而不是删除不起作用 tabL.deleteRow(2)} f

html代码:

<fieldset v-for=”key in addColumns”>

<legend>{{key.name}}</legend>

<fieldset v-for=”(key1,index) in key.source”>

<legend>编号{{index}}</legend>

<p v-for=”key2 in key1.source_info”>

<label>{{key2.name}}:</label>

<input v-if=”key2.type === ‘input'” type=”text” v-bind:class=”key.class” size=”30″ maxlength=”20″ name={{key2.name}} v-model=key2.value />

<input v-if=”key2.type === ‘data'” type=”text” name=”endDate” class=”date” size=”30″ v-model=key2.value />

<a v-if=”key2.type === ‘data'” class=”inputDateButton” href=”javascript:”>选择</a>

<input v-if=”key2.type === ‘search'” type=”hidden” name=”orgLookup.id” value=”${orgLookup.id}”/>

<input v-if=”key2.type === ‘search'” type=”text” v-bind:class=”key.class” name=”orgLookup.orgName” v-model=key2.value suggestFields=”orgNum,orgName” suggestUrl=”demo/database/db_lookupSuggest.html” lookupGroup=”orgLookup” />

<a v-if=”key2.type === ‘search'” class=”btnLook” v-bind:href=”‘__URL__/../Type/select/id/’+key2.source” target=”dialog” max=”false” lookupGroup=”orgLookup”>查找带回</a>

</p>

<a v-if=”index>0″ class=”btnDel” href=”javascript:” onclick=”$(this).parent().remove()” >删除</a>

</fieldset>

<a class=”btnAdd” href=”javascript:” v-on:click=”key.source.push(key.source[0])”>新增</a>

</fieldset>

data下的json数据

data: {

addColumns: [

{ name: ‘车辆情况’, type: “sub_add” ,source:

[

{source_info:[{name: ‘车辆类型’, type: “search”, source: “car_type” ,value:”},

{ name: ‘车牌号’, type: “input” ,value:”},

{ name: ‘车辆颜色’,type: “search”, source: “car_color” ,value:”}]}

]

},

{ name: ‘虚拟联系方式’, type: “sub_add” ,source:

[

{source_info:[{name: ‘虚拟身份类型’, type: “search”, source: “xuni_type” ,value:”},{ name: ‘对应账号’, type: “input” ,value:”}]}

]

},{ name: ‘家庭成员’, type: “sub_add” ,source:

[

{source_info:[{ name: ‘姓名’, type: “input” ,value:”},{ name: ‘证件号码’, type: “input” ,value:”},{ name: ‘联系方式’, type: “input” ,value:”},{ name: ‘关系类型’, type: “search”, source: “rel_type” ,value:”},{name: ‘虚拟身份类型’, type: “search”, source: “xuni_type” ,value:”},{ name: ‘对应账号’, type: “input” ,value:”}]}

]

},{ name: ‘拓展关系人信息’, type: “sub_add” ,source:

[

{source_info:[{ name: ‘姓名’, type: “input” ,value:”},{ name: ‘证件号码’, type: “input” ,value:”},{ name: ‘联系方式’, type: “input” ,value:”},{ name: ‘关系类型’, type: “search”, source: “rel_type” ,value:”},{ name: ‘备注’, type: “input” ,value:”}]}

]

}]

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11528351.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存