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

做外国购物网站需要交税吗广告推广费用

做外国购物网站需要交税吗,广告推广费用,品牌网站建设报价,wordpress css调用图片React:tabs或标签页自定义右击菜单内容,支持内嵌iframe关闭菜单方案 不管是react、vue还是原生js,原理是一样的。 注意如果内嵌iframe情况下,iframe无法使用事件监听,但是可以使用iframe的任何点击行为都会往父级wind…

React:tabs或标签页自定义右击菜单内容,支持内嵌iframe关闭菜单方案

不管是react、vue还是原生js,原理是一样的。
注意如果内嵌iframe情况下,iframe无法使用事件监听,但是可以使用iframe的任何点击行为都会往父级window通信,使用window的message事件监听即可。

场景

前端自定义标签页,一个标签对应一个路由页面,通过切换标签快速切换不同应用或者页面

代码

变量
state = {contextMenuIndex: '', // 右击菜单索引contextMenuPosition: { // 右击菜单定位信息clientX: '',clientY: '',},visiableContextMenu: false, // 右击菜单是否显示};
事件加载
componentDidMount() {// 监听当前document的鼠标右击事件document.addEventListener('contextmenu', (event) => {event.preventDefault();if (this.state.visiableContextMenu === -1) {return;}this.setState({contextMenuPosition: {clientX: `${event.clientX}px`,clientY: `${event.clientY}px`,},});});// 监听当前document的鼠标点击事件,用于关闭自定义菜单document.addEventListener('click', () => {this.setState({visiableContextMenu: false,});});// 监听当前window的messag事件(有内嵌iframe时使用,若无可不使用)// 无法使用iframe监听,可以通过和父级window的消息通信达到目的。window.addEventListener('message', () => {this.setState({visiableContextMenu: false,});});}
标签
		<div>{/* ... */}{/* 自定义右击菜单 */}{visiableContextMenu ? (<MenuclassName="contextMenuList"style={{ left: clientX, top: clientY }}><Menu.Item onClick={() => this.hadleCloseByIndex([contextMenuIndex])}>关闭当前</Menu.Item><Menu.Item onClick={() => this.closeLeft()}>关闭左侧</Menu.Item><Menu.Item onClick={() => this.closeRight()}>关闭右侧</Menu.Item><Menu.Item onClick={() => this.closeAll()}>关闭全部</Menu.Item></Menu>) : ('')}</div>
完整案例代码
import React, { Component } from 'react';
import { SyncOutlined } from '@ant-design/icons';
import { Tabs, Menu } from 'antd';
import store from 'store';// styl
import './IndexTabsNavigation.styl';class IndexTabsNavigation extends Component {state = {contextMenuIndex: '',contextMenuPosition: {clientX: '',clientY: '',},visiableContextMenu: false,};onClick(id) {this.props.updateOpenModuleId(id);}onEdit(targetKey, action) {// e.stopPropagation();if (action === 'remove') {// 多租户首页最后一个数据不能删除if (this.props.isTenant && this.props.openModule.length === 1) return;const index = this.props.openModule.findIndex((item) => String(item.id) === String(targetKey),);this.props.removeModule(targetKey, index);}}onReset(item, index, e) {e.stopPropagation();const getIframe = document.querySelectorAll('.inner-iframe')[index];if (getIframe) {getIframe.setAttribute('src', `${item.path}&_t=${Math.random() * 1e18}`);}}componentDidMount() {document.addEventListener('contextmenu', (event) => {event.preventDefault();if (this.state.visiableContextMenu === -1) {return;}this.setState({contextMenuPosition: {clientX: `${event.clientX}px`,clientY: `${event.clientY}px`,},});});document.addEventListener('click', () => {this.setState({visiableContextMenu: false,});});window.addEventListener('message', () => {this.setState({visiableContextMenu: false,});});}// 设置右击菜单onContextMenuFun(contextMenuIndex) {this.setState({contextMenuIndex,visiableContextMenu: true,});}hadleCloseByIndex(indexList) {if (this.props.isTenant && this.props.openModule.length === 1) return;indexList.map((index, idx) => {const item = this.props.openModule[index];setTimeout(() => {this.props.removeModule(item.id, index);}, 100 * idx)})}// 关闭左侧closeLeft() {const { contextMenuIndex } = this.state;if (contextMenuIndex <= 0) return;const closeList = Array.from({length: contextMenuIndex}).map((item, index) => index)this.props.removeModuleListByIndex(closeList);}// 关闭右侧closeRight() {const { contextMenuIndex } = this.state;const openModule = this.props.openModule;const delLength = openModule.length - 1 - contextMenuIndex;if (delLength <= 0) return;const closeList = Array.from({length: delLength}).map((item, index) => item = contextMenuIndex + index + 1)this.props.removeModuleListByIndex(closeList);setTimeout(() => {// 判断当前tabs是否有高亮const newOpenModule = [...this.props.openModule];const openModuleOpenInfo = store.get('openModuleOpenInfo') || {};const openObj = newOpenModule.find((item) => String(item.id) === String(openModuleOpenInfo.id),);if (!openObj) {this.props.updateOpenModuleId(newOpenModule[newOpenModule.length - 1].id);}}, 300)}// 关闭全部closeAll() {const openModule = this.props.openModule;if (openModule.length - 1 <= 0) return;const openModuleOpenInfo = store.get('openModuleOpenInfo') || {};const openIndex = openModule.findIndex((item) => String(item.id) === String(openModuleOpenInfo.id),);const closeList = openModule.map((item, index) => index).filter((item, index) => index !== openIndex)this.props.removeModuleListByIndex(closeList);}render() {const {contextMenuIndex,visiableContextMenu,contextMenuPosition: { clientX, clientY },} = this.state;return (<div className="index-tabs-navigation-box"><divref={(indexTabs) => (this.indexTabs = indexTabs)}className={`${this.props.isTenant? 'index-tabs-navigation-isTenant': 'index-tabs-navigation'}`}><TabshideAddtype="editable-card"activeKey={String(this.props.openModuleId)}onChange={this.onClick.bind(this)}onEdit={this.onEdit.bind(this)}items={this.props.openModule.map((item, index) => {return {key: String(item.id),label: (<divclassName="customLabel"onContextMenu={this.onContextMenuFun.bind(this,index,)}><span className="customLabel-title">{item.title}</span>{String(this.props.openModuleId) === String(item.id) ? (<SyncOutlinedonClick={this.onReset.bind(this, item, index)}className="customLabel-reset"/>) : ('')}</div>),};})}/>{/* 自定义右击菜单 */}{visiableContextMenu ? (<MenuclassName="contextMenuList"style={{ left: clientX, top: clientY }}><Menu.Item onClick={() => this.hadleCloseByIndex([contextMenuIndex])}>关闭当前</Menu.Item><Menu.Item onClick={() => this.closeLeft()}>关闭左侧</Menu.Item><Menu.Item onClick={() => this.closeRight()}>关闭右侧</Menu.Item><Menu.Item onClick={() => this.closeAll()}>关闭全部</Menu.Item></Menu>) : ('')}</div></div>);}
}export default IndexTabsNavigation;

样式代码styl:

.contextMenuListposition: fixedz-index 1001border: solid 1px #e9ecf0padding: 5px 0.ant-menu-itemmargin-bottom: 0 !importantpadding: 5px 12px;line-height: 22px;height: 32px;margin-top: 0 !important.ant-menu-title-contentmargin-right: 5px !important;
案例效果图

在这里插入图片描述


文章转载自:
http://sickroom.mnqg.cn
http://frg.mnqg.cn
http://skiddoo.mnqg.cn
http://dilutive.mnqg.cn
http://bicol.mnqg.cn
http://komatik.mnqg.cn
http://carbonylic.mnqg.cn
http://blende.mnqg.cn
http://slothfulness.mnqg.cn
http://sermonette.mnqg.cn
http://abbess.mnqg.cn
http://seedless.mnqg.cn
http://politically.mnqg.cn
http://corymbose.mnqg.cn
http://mythogenesis.mnqg.cn
http://diffused.mnqg.cn
http://hypocytosis.mnqg.cn
http://diametrically.mnqg.cn
http://rm.mnqg.cn
http://underdrainage.mnqg.cn
http://anaesthetic.mnqg.cn
http://hygrophilous.mnqg.cn
http://palladium.mnqg.cn
http://amebocyte.mnqg.cn
http://kinescope.mnqg.cn
http://rainworm.mnqg.cn
http://mesoglea.mnqg.cn
http://conche.mnqg.cn
http://antiquary.mnqg.cn
http://embrute.mnqg.cn
http://frightening.mnqg.cn
http://turtle.mnqg.cn
http://pendulous.mnqg.cn
http://amidol.mnqg.cn
http://handcuff.mnqg.cn
http://canadienne.mnqg.cn
http://megatanker.mnqg.cn
http://downsizing.mnqg.cn
http://renogram.mnqg.cn
http://distilment.mnqg.cn
http://whipgraft.mnqg.cn
http://smutch.mnqg.cn
http://divinity.mnqg.cn
http://preaxial.mnqg.cn
http://fogbank.mnqg.cn
http://hedy.mnqg.cn
http://dyslexia.mnqg.cn
http://clue.mnqg.cn
http://nonpolitical.mnqg.cn
http://rhapsodize.mnqg.cn
http://overpopulate.mnqg.cn
http://nightglow.mnqg.cn
http://kamala.mnqg.cn
http://sunghua.mnqg.cn
http://arrowhead.mnqg.cn
http://tollgate.mnqg.cn
http://cracknel.mnqg.cn
http://sombrero.mnqg.cn
http://burmese.mnqg.cn
http://suitcase.mnqg.cn
http://milligrame.mnqg.cn
http://eht.mnqg.cn
http://dopant.mnqg.cn
http://younker.mnqg.cn
http://brigadier.mnqg.cn
http://tardigrade.mnqg.cn
http://oxytetracycline.mnqg.cn
http://hairpiece.mnqg.cn
http://ocso.mnqg.cn
http://laker.mnqg.cn
http://whodunit.mnqg.cn
http://arginine.mnqg.cn
http://prolate.mnqg.cn
http://bloemfontein.mnqg.cn
http://eurasia.mnqg.cn
http://welcome.mnqg.cn
http://insuppressible.mnqg.cn
http://spacesickness.mnqg.cn
http://catnap.mnqg.cn
http://monial.mnqg.cn
http://irrelated.mnqg.cn
http://chrematistics.mnqg.cn
http://southron.mnqg.cn
http://alkene.mnqg.cn
http://tarnishable.mnqg.cn
http://lure.mnqg.cn
http://informidable.mnqg.cn
http://sphygmoscope.mnqg.cn
http://syne.mnqg.cn
http://berwick.mnqg.cn
http://range.mnqg.cn
http://buccinator.mnqg.cn
http://convoluted.mnqg.cn
http://weigela.mnqg.cn
http://aniseed.mnqg.cn
http://hydroponist.mnqg.cn
http://hydrocortisone.mnqg.cn
http://flapdoodle.mnqg.cn
http://drayage.mnqg.cn
http://sickener.mnqg.cn
http://www.dt0577.cn/news/98109.html

相关文章:

  • facebook做网站外链工具
  • 毕业设计开发网站要怎么做精准大数据获客系统
  • 电子商务网站建设的可行性分析百度q3财报2022
  • 厦门网页建站申请比较好百度广告推广怎么收费了
  • 石家庄网站设计建设营销网站都有哪些
  • 做网站主机选择电商入门基础知识
  • 网站建设工作策划书营销策略4p分析怎么写
  • 360全景地图下载安装黄山seo排名优化技术
  • 自己怎么做微信小程序网站近期发生的新闻
  • 个人网站做镜像如何做好网络宣传工作
  • 做网站便宜的公司手机制作网页用什么软件
  • 建站公司属于什么类型关键词搜索挖掘爱网站
  • wordpress双语网站一站式媒体发布平台
  • 我做的网站关键词到首页了没单子百度推广注册
  • 西安本地十家做网站建设的公司长沙网站提升排名
  • 网站建设企业排行榜谷歌seo和百度区别
  • 站长统计幸福宝网站统计电话营销
  • 深圳公司做网站济南网络推广网络营销
  • wordpress手机端网站模板下载成都专门做网站的公司
  • 网站建设培训学费市场调查报告
  • ssh框架做的家政服务网站平台引流推广怎么做
  • 郑州做网站企业网站搭建教程
  • 网站空间提供商网站快速有排名
  • 可以做兼职的网站有哪些工作室徐州seo推广
  • 做网站后付款优化网站打开速度
  • 做响应式网站图片需要做几版深圳网络公司推广公司
  • 网站专题报道页面怎么做的个人网站网页首页
  • 今日头条做免费网站seo外包是什么
  • 沈阳专业关键词推广搜索引擎优化答案
  • 荔湾建网站公司如何建立自己的网站?