var obtain = this.templateContent
let arr = obtain.match(/{(.*?)}/g)
if (this.isEdit) {
let strArr = this.dynamicParam.split(',')
if (arr == null) {
this.plaLists = []
} else {
this.plaLists = arr.map((item, index) => {
return {label: item, value: strArr[index]}
})
}
} else {
this.plaLists = arr.map(item => {
return {label: item, value: ''}
})
}
obtain为内容(string),match截取符合正则表达式的值组成数组arr(数组),strArr(以逗号分割的字符串)通过map循环赋值