您的位置:首页 > 房产 > 建筑 > 深圳龙华区房价多少一平方_网页制作心得体会_计算机培训机构排名前十_青岛网站设计微动力

深圳龙华区房价多少一平方_网页制作心得体会_计算机培训机构排名前十_青岛网站设计微动力

2025/1/9 4:33:09 来源:https://blog.csdn.net/lmy_loveF/article/details/144899848  浏览:    关键词:深圳龙华区房价多少一平方_网页制作心得体会_计算机培训机构排名前十_青岛网站设计微动力
深圳龙华区房价多少一平方_网页制作心得体会_计算机培训机构排名前十_青岛网站设计微动力

js 对数组的增删改查

字段在数据库存储为nvarchar ,varchar存储波斯语会乱码

数组格式:

{"en": [{"type": "10","value": "Confirm","color": ""},{"type": "20","value": "Cancel","color": ""}],"cn": [{"type": "10","value": "确认","color": ""},{"type": "20","value": "取消","color": ""}]
}

         <div style="float:left;height:100px;width:600px;"><el-form-item label="多语言配置" style="width:700px;" prop="validTanleHead"><el-input style="width: 180px" placeholder="请填写语言类型" v-model="lange_type" /><el-button class="filter-item" style="margin-left:0px;" type="primary" size="mini" @click="addLangeType()">添加语言类型</el-button><!-- <el-button class="filter-item" style="margin-left:0px;" type="danger" size="mini" @click="deleteLangeType()">删除</el-button> --><!-- <el-button class="filter-item" style="margin-left:0px;" type="primary" size="mini" @click="checkLanguageJSON()">校验JSON</el-button> --><br /><span></span><div v-for="(item, index) in tableData"><!-- {{item}} -->{{index}} <el-button class="filter-item" style="margin-top:10px;" type="primary" size="mini" @click="addRow(index)">添加</el-button><el-button class="filter-item" style="margin-top:10px;" type="danger" size="mini" @click="deleteLangeType(index)">删除 {{index}} </el-button><el-table :data="item" :key="index" style="width: 100%" border fit highlight-current-row><el-table-column prop="type" label="type" width="167"><template slot-scope="scope"><el-input class="tabletext" v-model="scope.row.type" size="mini" autosize /></template></el-table-column><el-table-column prop="value" label="value" width="166"><template slot-scope="scope"><el-input class="tabletext" v-model="scope.row.value" size="mini" autosize /></template></el-table-column><el-table-column prop="color" label="color" width="166"><template slot-scope="scope"><el-input class="tabletext" v-model="scope.row.color" size="mini" autosize /></template></el-table-column><el-table-column prop="color" width="80"><template slot-scope="scope"><el-button size="mini" type="danger" @click="DeleteRow(scope.row,index)">删除</el-button></template></el-table-column></el-table></div></el-form-item></div>
if (!this.checkLanguageJSON()) {//校验多语言JSON字符串return}
 DeleteRow (row, index) {var tempData = this.tableData[index]for (var i = 0; i < tempData.length; i++) {if (tempData[i].type == row.type) {tempData.splice(i, 1)this.tableData[index] = tempDatareturn}}},addRow (index) {this.tableData[index].push({type: "",value: "",color: "",})},checkLanguageJSON () {var tempMap = []var that = thisvar isOk = true;testLoop:for (var key in this.tableData) {var tempMap = {}for (var index in this.tableData[key]) {var tempType = this.tableData[key][index].typeif (tempType == "") {this.$message.error("语言类型【" + key + "】 type 不能为空");isOk = false;break testLoop;}if (tempType == tempMap[tempType]) {that.$message.error("语言类型【" + key + "】 type:" + tempType + " 重复");isOk = false;break testLoop;}tempMap[tempType] = tempType}}return isOk;},addLangeType () {if (this.lange_type == "") {this.$message.error("请填写语言类型");return}// key就是数组的下标for (var key in this.tableData) {if (key == this.lange_type) {this.$message.error("语言类型已存在,请勿重复添加!");return}}var lange_type = this.lange_typevar tempData = {[lange_type]: [{type: "",value: "",color: "",}]};this.tableData = Object.assign({}, this.tableData, tempData)},deleteLangeType (index) {delete this.tableData[index]this.tableData = Object.assign({}, this.tableData)},

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com