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

知名网站制作企业电商网站图片

知名网站制作企业,电商网站图片,网站建设行业市场规模,阿里巴巴外贸圈文章目录 问题目前解决效果 v1思路 目前解决效果 v0思路 代码V1 问题 自己封装的 AgGrid 如何自定义传递 icon &#xff0c;以及点击事件的处理&#xff1f; 目前解决效果 v1 思路 目前解决效果 v0 思路 一张图片说明一下 代码 V1 父组件使用 <template><MyPageL…

文章目录

  • 问题
  • 目前解决效果 v1
    • 思路
  • 目前解决效果 v0
    • 思路
  • 代码
    • V1


问题

自己封装的 AgGrid 如何自定义传递 icon ,以及点击事件的处理?


目前解决效果 v1

在这里插入图片描述

思路

在这里插入图片描述


目前解决效果 v0

在这里插入图片描述


思路

一张图片说明一下

在这里插入图片描述

代码

V1

父组件使用

<template><MyPageLayout @handleSearch="handleSearch"><MyAgGrid :columnDefs="grid.columnDefs" :rowData="grid.rowData" :gridOptions="grid.gridOptions":setterIcon="setterIcon" @handleAction="handleAction" :setterWidth="120" ref="myAgGridRef" /></MyPageLayout>
</template><script>
import MyPageLayout from '@/components/MyPageLayout/index.vue'
import MyAgGrid from '@/components/MyAgGrid/index_v1.vue'
import svgComponent from './svgComponent.vue'export default {name: 'classOfSilo',components: {MyPageLayout,MyAgGrid,},data() {return {setterIcon: [{ icon: `<span>1</span>`, tip: 'html' },{ icon: svgComponent, tip: 'component' },{ icon: 'el-icon-eleme', tip: '11' },{ icon: 'el-icon-s-tools', tip: '22' },{ icon: 'el-icon-phone', tip: '33' },],};},
}
</script>

svgComponent

<template><img :src="findsvg" class="find-svg" />
</template><script>
import findsvg from '@/assets/erp-icons/find-replace.svg';
export default {name: 'findsvg',data() {return {findsvg}},methods: {}
}
</script><style lang="scss" scoped>
.find-svg {width: 16px;height: 16px;cursor: pointer;position: relative;top: -2px;
}
</style>

二次封装 MyAgGrid

<template><AgGridVue :style="myStyle" :class="theme" :columnDefs="mergedColumnDefs" :rowData="rowData":gridOptions="mergedGridOptions" @grid-ready="onGridReady"></AgGridVue>
</template><script>
import { AgGridVue } from "@ag-grid-community/vue";
import { ModuleRegistry } from '@ag-grid-community/core';
import { AG_GRID_LOCALE_CN } from '@ag-grid-community/locale';
import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
import Setter from '@/components/MyAgGrid/components/Setter.vue'ModuleRegistry.registerModules([ClientSideRowModelModule,RowGroupingModule
]);export default {name: 'MyAgGrid',components: {AgGridVue,Setter,},props: {theme: {type: String,// default: 'ag-theme-quartz-dark'default: 'ag-theme-quartz'},columnDefs: {type: Array,default: () => []},rowData: {type: Array,default: () => []},gridOptions: {type: Object,default: () => ({})},isShowTips: {type: Boolean,default: true},myStyle: {type: Object,default: () => ({ width: '100%', height: 'calc(100vh - 270px)' })},showDefaultColumnDefs: {type: Boolean,default: true},setterIcon: {type: Array,default: () => [{ icon: 'el-icon-edit', tip: '编辑' },{ icon: 'el-icon-delete', tip: '删除' }]},setterWidth: {type: Number,default: 70}},data() {return {defaultGridOptions: {tooltipShowDelay: 1000,  // tooltip 只有添加 tooltipShowDelay 才会显示localeText: AG_GRID_LOCALE_CN,animateRows: true, // 添加这一行},defaultColumnDefs: [{headerName: "操作",width: this.setterWidth,field: "setter",pinned: 'right',cellRenderer: 'Setter',cellRendererParams: {isShowTips: this.isShowTips,setterIcon: this.setterIcon,actionHandler: this.handleAction, // 传递点击处理方法},resizable: true}],gridApi: null}},computed: {mergedGridOptions() {return { ...this.defaultGridOptions, ...this.gridOptions };},mergedColumnDefs() {if (this.showDefaultColumnDefs == false) {return [...this.columnDefs]}return [...this.defaultColumnDefs, ...this.columnDefs];}},methods: {getGridApi() {return this.gridApi},onGridReady(params) {this.gridApi = params.api},handleAction(index, rowData) {this.$emit('handleAction', index, rowData)},},
}
</script><style scoped lang="scss">
::v-deep .ag-pinned-right-header {// margin-right: 16px;.ag-header-row-column {padding-right: 16px;}
}::v-deep .ag-pinned-left-header {border-right: none;
}::v-deep .ag-pinned-right-cols-container {margin-right: 0 !important;
}::v-deep .ag-center-cols-container {margin-right: 0 !important;
}/deep/ .ag-root-wrapper {border-radius: 0;
}
</style>

Setter.vue

<template><div class="setter"><template v-for="(item, index) in iconList"><el-tooltip v-if="isShowTips" class="item" effect="light" :content="item.tip" placement="bottom-start":key="`icon-${index}`"><RenderIcon :icon="item.icon" class="icon-wrapper" @click.native="clickIcon(index)" /></el-tooltip><RenderIcon v-else :icon="item.icon" class="icon-wrapper" @click.native="clickIcon(index)" /></template></div>
</template><script>
export default {name: "Setter",components: {RenderIcon: {props: {icon: {type: [Object, String],required: true,},},methods: {isComponent(icon) {return typeof icon === "object" && icon !== null && typeof icon.render === "function";},isHtmlTag(icon) {const htmlTagRegex = /^<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>(.*?)<\/\1>$/;return typeof icon === "string" && htmlTagRegex.test(icon);},},render(h) {const { icon } = this;if (this.isComponent(icon)) {return h(icon, { class: "mr6" });} else if (this.isHtmlTag(icon)) {return h("span", { domProps: { innerHTML: icon }, class: "mr6" });} else {return h("i", { class: `mr6 ${icon}` });}},},},computed: {iconList() {return this.params.setterIcon;},isShowTips() {return this.params.isShowTips;},},methods: {clickIcon(index) {this.params.actionHandler(index, this.params.data);},},
};
</script><style lang="scss" scoped>
.mr6 {margin-right: 6px;
}.icon-wrapper {cursor: pointer;
}
</style>
http://www.khdw.cn/news/23520.html

相关文章:

  • 微信网站制作入门如何百度推广
  • 禅城专业网站建设公司做网站推广公司
  • 安徽网站建设今日国际新闻最新消息十条
  • 新建网站怎样绑定域名网络推广业务
  • 广告型网站怎么做东莞seo外包平台
  • 快速搭建外贸网站免费推广网站推荐
  • 菜鸟怎样做自己的网站如何做百度免费推广
  • 外贸资讯平台搜索引擎优化培训班
  • 重庆梁平网站制作公司营销策划的六个步骤
  • 上海缔客网站建设公司html底部友情链接代码
  • liunx做网站跳转服务器简单网页设计模板html
  • 西宁网站托管代哥seo
  • 淮安做网站seo深圳网络推广哪家好
  • crm系统操作流程临沂seo整站优化厂家
  • 怎么自己做网站链接百度电脑版下载安装
  • 怎么把网站上传到空间买链接
  • 阿里云oss做网站锦绣大地seo
  • 北京企业建网站定制价格seo推广外包
  • 手机网站用二级目录做的弊端松松软文
  • 珠海网站建设小程序seo关键词排名软件流量词
  • wordpress可以制作什么网站吗seo推广排名平台有哪些
  • 深圳网站开发哪家公司好软文写作技巧及范文
  • 网站建设选哪家搜索引擎优化公司排行
  • 纵横互联 武汉网站建设现在比较好的营销平台
  • 那可以做网站百度怎么注册自己的网站
  • 重庆seo网站推广优化百度一键安装
  • 有什么网站可以帮人做模具吗2022最新时事新闻及点评
  • 重庆建设工程公司网站成品网站1688入口网页版怎样
  • 基于php技术的网站建设东莞百度推广优化公司
  • 做的比较好看的国内网站在百度做广告多少钱