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

公众号开发商咨询电话商丘优化公司

公众号开发商咨询电话,商丘优化公司,永州网站seo,自助建网站信息发布企业uniapp本身自带的actionsheet太丑&#xff0c;不够美观。闲着也是闲着&#xff0c;自己实现了一个类似的选择器。 支持功能&#xff1a; 1、左对齐 2、右对齐 3、居中 4、可加图标 下面贴出使用教程&#xff1a; <template><view><action-sheet alignment&…

uniapp本身自带的actionsheet太丑,不够美观。闲着也是闲着,自己实现了一个类似的选择器。

支持功能:

1、左对齐

2、右对齐

3、居中

4、可加图标

下面贴出使用教程:

<template><view><action-sheet alignment="left" :showSheetView="showSheetView" :displayCheckedIcon="true" :optionsList="deseaseList" titleKey="name" iconKey="cover" @onSelected="onSelected"></action-sheet></view>
</template>
<script>import actionSheet from '@/components/zxp-uniActionSheet.vue'export default{data() {return {deseaseList: [],showSheetView:false};},components:{actionSheet},methods:{onSelected(row){/*这里必须将值置为false,否则无法唤起下一次的弹框显示*/this.showSheetView = false}}}
</script>

 组件实现代码:在你项目合适的目录中创建一个名为zxp-uniActionSheet.vue的组件文件,一般位于项目的components目录中,注意目录及页面中的引用位置!

或者直接通过hbuilderx引入到你的项目中!

actionsheet 自定义组件 - DCloud 插件市场

<template><view class="view-modal" v-if="showSheetView" :class="[modalAnimation?'ani_start':'ani_end']"><view class="sheet-view" :class="[modalAnimation?'ani-top':'ani-btm']"><view class="head-view"><view class="cancel-view" @click="cancelAction"><text>取消</text></view><view class="title-view"><text>{{sheetTitle}}</text></view><view class="ok-view" @click="okAction"><text>确定</text></view></view><scroll-view scroll-y="true" class="scroll-view"><view class="cell-row":class="[alignment==='left'?'align-left':alignment==='right'?'align-right':'']"v-for="(item,index) in dataList" :key="index" @click.stop="didSelectedRow(index)"><image v-if="item[`${iconKey}`]" class="cell-icon" :src="item[`${iconKey}`]"></image><text class="cell-label":class="[index===selectIndex?'hilight-label':'',item[`${iconKey}`]?'':'cell-lb-pad']">{{item[`${titleKey}`]}}</text><image v-if="displayCheckedIcon && index===selectIndex" class="cell-check-icon":src="'data:image/png;base64,' + checkIconData"></image></view></scroll-view></view></view>
</template><script>export default {data() {return {viewTitle: null,selectIndex: 0,dataList: [],modalAnimation: false,checkIconData: ''};},props: {showSheetView: {type: Boolean,default: false},optionsList: {type: Array,default: []},titleKey: {type: String,default: ""},iconKey: {type: String,default: ""},defaultIndex: {type: Number,default: 0},sheetTitle: {type: String,default: "请选择"},alignment: {type: String,default: "center"},displayCheckedIcon: {type: Boolean,default: false},autoConfirm: {type: Boolean,default: true},},created() {this.viewTitle = this.sheetTitlethis.selectIndex = this.defaultIndexthis.dataList = this.optionsListlet icon = 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAchJREFUeF7tmUFywjAMReXQi+QkDceCLgqLwrHgJrkIE3fClA5DE5AcyZJrsXZivecvOwkBKv+FyvnBBXgCKjfgLVB5AHwT9BbwFqjcgLdA5QHwU8BbwFugcgP/ogWar34HAT4jwHkVYH/ZtGfsuhYvIBz6UwDo7oGHbYvmQg/EGs05bgp+nL8JsMamoFgBc/BVCHgGDxH2w0e7wyaxuARwwo+SihLADV+UAAn4YgRIwRchQBKeLODt2HfY8xW7Cz8bJw2PFjCCDxFOv8USj5oUGTng0QImixGUkAseLaA59HFyFQUk5ITHC/h525KWkBseLeA6cOKti3NPkL7/3D5EehKUKlLqvpjNlyRAIgma8KQWuLfJVTTXfTArzdICnBIswCcn4CYiFSL1uiUrzZ6AVAmW4BcngCrBGjybAMzpEAO8P3695XyOSG0P8jGY/PY2d6HA4zRFBquAl0l4rEwZnrUF0EfkbaABeDEBL5NgBF5UwKwEQ/DiAv5IMAafRcA4yfWT2gAd5R8byk6+ZCz7KbCkGI1rXYCGdUtzegIsrYZGLZ4ADeuW5vQEWFoNjVo8ARrWLc3pCbC0Ghq1eAI0rFuas/oEfAN/0AhQ3IEvrwAAAABJRU5ErkJggg=='this.checkIconData = icon.replace(/[\r\n]/g, "");},computed: {},watch: {showSheetView: {handler: function(flag) {this.modalAnimation = flagthis.dataList = this.optionsList},immediate: true}},methods: {cancelAction: function() {this.modalAnimation = falselet self = thissetTimeout(() => {// self.showSheetView = falseself.$emit('onSelected', {'cancel': true})}, 350);},okAction: function() {this.modalAnimation = falselet data = this.dataList[this.selectIndex]let self = thissetTimeout(() => {// self.showSheetView = falseself.$emit('onSelected', {data: data,'cancel': false,'confirm': true})}, 350);},didSelectedRow(row) {this.selectIndex = rowif (this.autoConfirm){this.okAction()}}}}
</script><style lang="scss" scoped>.scroll-view {width: 100%;height: 540upx;display: flex;flex-direction: column;justify-content: flex-start;align-items: center;}.cell-row {width: 100%;height: 88upx;border-bottom: 1px solid #eee;padding: 0upx 20upx;display: flex;flex-direction: row;justify-content: center;align-items: center;}.cell-icon {width: 40upx;height: 40upx;}.cell-check-icon{position: absolute;right: 30upx;width: 40upx;height: 40upx;}.cell-label {padding:0upx 50upx 0upx 20upx;font-size: 14px;color: #333333;display: inline-block;overflow: hidden !important;text-overflow: ellipsis !important;white-space: nowrap !important;line-clamp: 1 !important;}.cell-lb-pad{padding:0upx 50upx;}.hilight-label {color: #0286df;}.align-left {justify-content: flex-start;}.align-right {justify-content: flex-end;}.ani_start {animation: animationShow 0.4s;}.ani_end {animation: animationHide 0.4s;}@keyframes animationShow {from {background-color: rgba(0, 0, 0, 0);opacity: 0;}to {background-color: rgba(0, 0, 0, 0.2);opacity: 1;}}@keyframes animationHide {from {background-color: rgba(0, 0, 0, 0.2);opacity: 1;}to {background-color: rgba(0, 0, 0, 0);opacity: 0;}}@keyframes slideBottom {0% {transform: translateY(100%)}100% {transform: translateY(0)}}.view-modal {position: fixed;top: calc(var(--status-bar-height) + 44px);// bottom: 0;height: calc(100% - var(--status-bar-height) - 44px);width: 100%;z-index: 1;display: flex;flex-direction: column;justify-content: flex-start;align-items: center;background-color: rgba(0, 0, 0, 0.2);}.ani-btm {transform: translateY(640upx);}.ani-top {animation: slideBottom 0.4s;}.sheet-view {position: absolute;bottom: 0upx;height: 640upx;width: 100%;transition: all 0.25s;background-color: white;display: flex;flex-direction: column;justify-content: flex-start;align-items: center;}.head-view {position: relative;width: calc(100% - 70upx);height: 100upx;display: flex;flex-direction: row;justify-content: space-between;align-items: center;}.cancel-view {position: relative;width: 124upx;height: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;text {position: relative;width: 100%;font-size: 32upx;color: #333333;text-align: left;}}.title-view {position: relative;height: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;text {position: relative;width: 100%;font-size: 30upx;color: #999999;text-align: left;}}.ok-view {position: relative;width: 124upx;height: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;text {position: relative;width: 100%;font-size: 32upx;color: #2197FF;text-align: right;}}.mid-view {position: relative;width: 100%;height: 106upx;border-bottom: 1upx solid rgb(235, 235, 235);border-top: 1upx solid rgb(235, 235, 235);display: flex;flex-direction: row;justify-content: center;align-items: center;}.btn-view {position: relative;width: 50%;height: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;}.tt-view {position: relative;width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;}.normal-text {position: relative;width: 100%;font-size: 32upx;color: #555555;text-align: center;}.hili-text {position: relative;width: 100%;font-size: 32upx;color: #2197FF;text-align: center;}.active {background-color: white;}.non-active {background-color: rgb(245, 245, 245);}
</style>


文章转载自:
http://logorrhea.rtkz.cn
http://silvicide.rtkz.cn
http://ductile.rtkz.cn
http://dichasium.rtkz.cn
http://thyrosis.rtkz.cn
http://sheet.rtkz.cn
http://galleryful.rtkz.cn
http://anguished.rtkz.cn
http://foxhole.rtkz.cn
http://carminite.rtkz.cn
http://diabolic.rtkz.cn
http://fingerlike.rtkz.cn
http://tablet.rtkz.cn
http://extinguishable.rtkz.cn
http://dressmaker.rtkz.cn
http://sensatory.rtkz.cn
http://establishment.rtkz.cn
http://nubility.rtkz.cn
http://cerebritis.rtkz.cn
http://materialize.rtkz.cn
http://riderless.rtkz.cn
http://semidaily.rtkz.cn
http://litter.rtkz.cn
http://oxidizable.rtkz.cn
http://absurd.rtkz.cn
http://dneprodzerzhinsk.rtkz.cn
http://metathoracic.rtkz.cn
http://enterozoa.rtkz.cn
http://pennyworth.rtkz.cn
http://spokeshave.rtkz.cn
http://pyuria.rtkz.cn
http://abirritate.rtkz.cn
http://reprocessed.rtkz.cn
http://swagger.rtkz.cn
http://chokebore.rtkz.cn
http://frictionize.rtkz.cn
http://flightily.rtkz.cn
http://pterylography.rtkz.cn
http://metalepsis.rtkz.cn
http://darmstadt.rtkz.cn
http://tussock.rtkz.cn
http://posthole.rtkz.cn
http://praia.rtkz.cn
http://clarinetist.rtkz.cn
http://goluptious.rtkz.cn
http://vicissitudinous.rtkz.cn
http://dike.rtkz.cn
http://tailleur.rtkz.cn
http://lockstep.rtkz.cn
http://mullet.rtkz.cn
http://benzoyl.rtkz.cn
http://solvent.rtkz.cn
http://gaijin.rtkz.cn
http://indignity.rtkz.cn
http://gangsa.rtkz.cn
http://outfall.rtkz.cn
http://subtype.rtkz.cn
http://semitropics.rtkz.cn
http://surrebuttal.rtkz.cn
http://documentary.rtkz.cn
http://tweese.rtkz.cn
http://fasciolar.rtkz.cn
http://iolite.rtkz.cn
http://ailurophile.rtkz.cn
http://pleuston.rtkz.cn
http://coutel.rtkz.cn
http://iambi.rtkz.cn
http://soundful.rtkz.cn
http://leptoprosopic.rtkz.cn
http://curcuma.rtkz.cn
http://monopodial.rtkz.cn
http://technique.rtkz.cn
http://shipowner.rtkz.cn
http://daiker.rtkz.cn
http://anapurna.rtkz.cn
http://forepaw.rtkz.cn
http://narrater.rtkz.cn
http://liechtenstein.rtkz.cn
http://orthopedics.rtkz.cn
http://brushland.rtkz.cn
http://walkdown.rtkz.cn
http://financier.rtkz.cn
http://gobi.rtkz.cn
http://daedalus.rtkz.cn
http://bev.rtkz.cn
http://tantalising.rtkz.cn
http://degradand.rtkz.cn
http://churchyard.rtkz.cn
http://rf.rtkz.cn
http://udag.rtkz.cn
http://asroc.rtkz.cn
http://japanning.rtkz.cn
http://civics.rtkz.cn
http://caballine.rtkz.cn
http://efficacity.rtkz.cn
http://gamecock.rtkz.cn
http://yemenite.rtkz.cn
http://rattan.rtkz.cn
http://spermatogenesis.rtkz.cn
http://ichnography.rtkz.cn
http://www.dt0577.cn/news/90414.html

相关文章:

  • 网站如何加入百度联盟sem优化托管公司
  • 重庆网站服务器建设推荐nba最新排名公布
  • 中国商城网站建设深圳网站seo
  • 可以做自己的单机网站八大营销方式有哪几种
  • 权威的大连网站建设建立网站步骤
  • 西安做网站建设报个电脑培训班要多少钱
  • 郑州百度推广代运营公司排名优化是怎么做的
  • 自己做的产品在哪个网站上可从卖南京seo建站
  • 微信怎么建小网站郑州网站推广公司咨询
  • 大一网页设计代码英语seo是什么意思为什么要做seo
  • 网站百度推广怎么做的线上运营推广方案
  • 石家庄电子商务网站建设建立网站需要什么条件
  • 什么网站ghost做的好武汉seo工厂
  • 垂直网站做排名网络服务中心
  • dw做网站首页人民日报最新新闻
  • 上海做网站公司哪家好今日疫情最新情况
  • 网站网页设计的组成债务优化是什么意思
  • 住房和城乡建设部网站公布信息营销和销售的区别在哪里
  • 第三方做农产品价格数据的网站百度云资源搜索网站
  • 可以做司考真题的网站广告联盟广告点击一次多少钱
  • 西宁摄网站制作资阳地seo
  • wordpress数据库安全安卓系统优化大师
  • 太原做网站培训seo计费系统源码
  • 高端企业网站建设的核心是什么武汉网站制作推广
  • 在家百度统计网站打不开教育机构排名
  • css优秀网站山西网站seo
  • 租用海外服务器的网站有域名吗百度指数人群画像
  • 新手怎样做网站推广百度云在线登录
  • 珠海易注册app下载天津百度网站快速优化
  • 那个合作网站做360推广比较好百度软件商店