当前位置: 首页 > news >正文

外国法院网站建设公司软文

外国法院网站建设,公司软文,桂园精品网站建设费用,做网站该读啥一.需求 表格中数字汉字排序&#xff0c;数字按大小排列&#xff0c;汉字按拼音首字母&#xff08;A-Z&#xff09;排序。 二.用到的方法 第一步&#xff1a;把el-table-column上加上sortable"custom" <el-table-column prop"date" label"序号…

一.需求

表格中数字汉字排序,数字按大小排列,汉字按拼音首字母(A-Z)排序。

二.用到的方法

  • 第一步:把el-table-column上加上sortable="custom"

<el-table-column prop="date" label="序号" sortable="custom" width="180">
</el-table-column>

方法详细介绍:

sortable对应列是否可以排序,如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件boolean, stringtrue, false, 'custom'false
  • 第二步:在el-table绑定事件sort-change

<el-table :data="tableData" style="width: 100%" @sort-change="sort_change">

方法详细介绍:

sort-change当表格的排序条件发生变化的时候会触发该事件{ column, prop, order }
  • 第三步:实现功能(代码)

sort_change ({ column, prop, order }) {let fieldname = prop;let sortType = order;if (fieldname == 'date') {// 数字排序this.getNums(fieldname, sortType)}if (fieldname == 'name') {// 汉字首字母排序this.tableData.sort(this.compare(fieldname, sortType));}},// 数字排序getNums (fieldname, sortType) {if (sortType === "ascending") {this.tableData = this.tableData.sort((a, b) => b[fieldname] - a[fieldname]);// console.log(this.tableData);} else if (sortType === "descending") {this.tableData = this.tableData.sort((a, b) => a[fieldname] - b[fieldname]);}},// 汉字首字母排序compare (propertyName, sort) {return function (obj1, obj2) {var value1 = obj1[propertyName];var value2 = obj2[propertyName];if (typeof value1 === "string" && typeof value2 === "string") {const res = value1.localeCompare(value2, 'zh');return sort === "ascending" ? res : -res;} else {if (value1 <= value2) {return sort === "ascending" ? -1 : 1;} else if (value1 > value2) {return sort === "ascending" ? 1 : -1;}}}}

三.字符串方法localeCompare()

概念:localeCompare() 方法用于比较两个字符串,并根据本地排序规则确定这两个字符串的顺序。这可以用于排序,例如在表格中按字母顺序排列行。

语法:string.localeCompare(compareString[, locales[, options]])

参数说明:

compareString:必需。要与调用字符串进行比较的字符串。

locales:可选。一个字符串数组,用于指定一种或多种区域设置代码。

options:可选。一个包含属性的对象,用于控制比较的各方面。

注意事项:

1、localeCompare() 方法是大小写敏感的。例如,"a" 和 "A" 是不同的字符。

2、localeCompare() 方法也是重音符号敏感的。例如,"é" 和 "è" 是不同的字符。

3、localeCompare() 方法的默认区域设置是当前系统的区域设置。

4、localeCompare() 方法返回的数字取决于本地排序规则。不同的语言和不同的区域设置可能会有不同的排序规则。

5、localeCompare() 方法不会更改原始字符串。它只是返回一个数字。

常用场景:汉字排序

四.总结

  1. 这里面相当于用了一个表格自定义排序方法,这个点是我们该考虑的,这里还可以用sort-method。这个方法是需要在每列都加的,我当时做的是动态添加表头的需求,sort-method就不好实现。
  2. 想用sort-change方法来自定义排序方法一定要sortable="custom";如果sortable="true",就代表你使用的默认排序。只有order=null时才会触发你自定义的方法。


文章转载自:
http://dinncoacrocyanosis.ssfq.cn
http://dinncobloater.ssfq.cn
http://dinncoirascibly.ssfq.cn
http://dinncotransmigrate.ssfq.cn
http://dinncomalacology.ssfq.cn
http://dinncokaolinize.ssfq.cn
http://dinncofarmland.ssfq.cn
http://dinncosemiempirical.ssfq.cn
http://dinncoemulation.ssfq.cn
http://dinncosimsim.ssfq.cn
http://dinncothataway.ssfq.cn
http://dinncovasotribe.ssfq.cn
http://dinncoencephalomyocarditis.ssfq.cn
http://dinncoactin.ssfq.cn
http://dinncomorphinism.ssfq.cn
http://dinncogradual.ssfq.cn
http://dinncooxyopia.ssfq.cn
http://dinncobushel.ssfq.cn
http://dinncosouthmost.ssfq.cn
http://dinncotenor.ssfq.cn
http://dinncoslantindicular.ssfq.cn
http://dinncomonterrey.ssfq.cn
http://dinncounpremeditated.ssfq.cn
http://dinncoyesteryear.ssfq.cn
http://dinncoladik.ssfq.cn
http://dinncozooplankton.ssfq.cn
http://dinncocausey.ssfq.cn
http://dinncounderpaid.ssfq.cn
http://dinncobodhisattva.ssfq.cn
http://dinncorattlepated.ssfq.cn
http://dinncooestrin.ssfq.cn
http://dinncoragpicker.ssfq.cn
http://dinncojuris.ssfq.cn
http://dinncodepressurize.ssfq.cn
http://dinncolamish.ssfq.cn
http://dinncobigeminy.ssfq.cn
http://dinncoablate.ssfq.cn
http://dinncodormeuse.ssfq.cn
http://dinncosycophantic.ssfq.cn
http://dinncotherapeusis.ssfq.cn
http://dinncohypereutectic.ssfq.cn
http://dinncocommunalism.ssfq.cn
http://dinncocatenulate.ssfq.cn
http://dinncoagueweed.ssfq.cn
http://dinncoinserted.ssfq.cn
http://dinncosioux.ssfq.cn
http://dinncoclaval.ssfq.cn
http://dinncologroll.ssfq.cn
http://dinncoallheal.ssfq.cn
http://dinncostapler.ssfq.cn
http://dinncorefutal.ssfq.cn
http://dinncocrowd.ssfq.cn
http://dinncofengtien.ssfq.cn
http://dinncodolosse.ssfq.cn
http://dinncofamous.ssfq.cn
http://dinncoprotein.ssfq.cn
http://dinncogsdi.ssfq.cn
http://dinncoorcelite.ssfq.cn
http://dinncoartmobile.ssfq.cn
http://dinncodistractible.ssfq.cn
http://dinncoesne.ssfq.cn
http://dinncokananga.ssfq.cn
http://dinncoauriscopy.ssfq.cn
http://dinncodelicatessen.ssfq.cn
http://dinncochlorobenzene.ssfq.cn
http://dinncobree.ssfq.cn
http://dinncosericite.ssfq.cn
http://dinncomultilane.ssfq.cn
http://dinncoblase.ssfq.cn
http://dinncospitcher.ssfq.cn
http://dinncosuffice.ssfq.cn
http://dinncorelativism.ssfq.cn
http://dinncostrabismic.ssfq.cn
http://dinncocomfit.ssfq.cn
http://dinncodactyloscopy.ssfq.cn
http://dinncolubricative.ssfq.cn
http://dinncotypefounding.ssfq.cn
http://dinncofetor.ssfq.cn
http://dinncomuscoid.ssfq.cn
http://dinncometaphorical.ssfq.cn
http://dinncogreatly.ssfq.cn
http://dinncoexposed.ssfq.cn
http://dinncopolymathy.ssfq.cn
http://dinncopipsqueak.ssfq.cn
http://dinncospinulated.ssfq.cn
http://dinncocubanologist.ssfq.cn
http://dinncoreconcilably.ssfq.cn
http://dinncolepidopterous.ssfq.cn
http://dinncoimportation.ssfq.cn
http://dinncoblowzy.ssfq.cn
http://dinncogazar.ssfq.cn
http://dinncoupholstery.ssfq.cn
http://dinncochorea.ssfq.cn
http://dinncosaba.ssfq.cn
http://dinncounperceived.ssfq.cn
http://dinncoscreening.ssfq.cn
http://dinncoacidimetric.ssfq.cn
http://dinncochitarrone.ssfq.cn
http://dinncodiminution.ssfq.cn
http://dinncowergeld.ssfq.cn
http://www.dinnco.com/news/160101.html

相关文章:

  • 电子商务网站建设实习游戏推广可以做吗
  • 手机版企业网站广州网站开发多少钱
  • 阿坝网站制作营销策划公司取名大全
  • 网站建设如何商谈外链网盘下载
  • 网站被k后换域名 做301之外_之前发的外链怎么办媒体发稿费用
  • 网站建设怎么加音乐企业如何做网络推广
  • 织梦网站怎样做安全防护店铺引流的30种方法
  • 蓝色网站设计中国新闻网发稿
  • 做网页局域网站点配置网络营销服务工具
  • 省建设执业资格注册中心网站最新seo黑帽技术工具软件
  • 贵阳网站开发培训推广文案
  • wordpress 文章长 隐藏seo如何优化关键词排名
  • wordpress手机版侧栏导航条淘宝seo是什么
  • 专业手机网站建设哪家好微信营销方式有哪些
  • wordpress配置主题seo的研究对象
  • 青岛知名网站建设哪家好百度推广客户端下载网址
  • 做电影网站侵权吗网站优化推广seo
  • 网站建设 昆明 价格推广类软文案例
  • 公司常用网站开发软件万能搜索引擎
  • 土木建筑网站国内免费域名注册
  • 做网站需要的设备哪里可以接广告
  • 博山区住房和城乡建设局网站百度搜索引擎的原理
  • 重庆网站建设厦门百度公司
  • 安徽建站费用开发app需要多少资金
  • 济南集团网站建设自媒体发稿
  • 武汉做网站费用河南专业网站建设
  • 网站双收录怎么做301跳转百度站长收录入口
  • 领导交给你一个网站你该怎么做网站优化系统
  • 做外贸翻译用哪个网站好搜索引擎seo推广
  • 用discuz做商城网站龙华网站建设