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

在dw上做网站首页导航栏app推广一手单

在dw上做网站首页导航栏,app推广一手单,深圳做小程序开发哪家好,wordpress 提取文章段落背景 为了解决uni-app 任意位置出现弹窗 解决方案 一、最初方案 受限于uni-app 调用组件需要每个页面都引入注册才可以使用,此方案繁琐,每个页面都要写侵入性比较强 二、改进方案 app端:新建一个页面进行跳转,可以实现伪弹窗…

背景

为了解决uni-app 任意位置出现弹窗

解决方案

一、最初方案

受限于uni-app 调用组件需要每个页面都引入注册才可以使用,此方案繁琐,每个页面都要写侵入性比较强

二、改进方案

app端:新建一个页面进行跳转,可以实现伪弹窗(其实是打开一个背景透明的页面)

web端: 全局挂载body 插入一个弹窗

三、初步实现方案

就是 利用条件编译,web端写组件、app 端写页面,利用不同的生命周期,完成通用的逻辑

四、详细实现方案

1、完成弹窗页面开发

统一暴露一个show 方法,app 端使用 onload 监听事件触发,web端使用 show 方法触发

    <template><u-popup id="globalPopup-box" :show="params.show" :mode="params.mode" bgColor="transparent"@close="cancelSubmit(true)"><template v-if="params.type === 1"><view class="globalPopupContent" :class="{ globalPopupContentCenter: params.mode == 'center' }"><view class="title">{{ params.title }}</view></view></template><template v-else><view class="globalPopupContent" :class="{ globalPopupContentCenter: params.mode == 'center' }"><view class="title">{{ params.title }}</view></view></template></u-popup>
</template><script>
export default {name: "globalPopup",data() {return {eventChannel: null,params: {},}},// #ifdef APP-PLUSonLoad() {this.eventChannel = this.getOpenerEventChannel();this.eventChannel.on('globalPopup', (data) => {console.log('globalPopup:', data)this.init(data)})},// #endifmethods: {init(data) {this.params = data// 通用逻辑写在这里},// #ifdef H5show(data) {console.log('H5globalPopup:', data)this.init(data)},// #endifcancel() {// #ifdef APP-PLUSlet _this = this;uni.navigateBack({delta: 1,success() {_this.eventChannel.emit('cancel');}})// #endifthis.hide()// #ifdef APP-PLUSthis.params.cancel && this.params.cancel();// #endif},confirm() {// #ifdef APP-PLUSlet _this = this;uni.navigateBack({delta: 1,success() {_this.eventChannel.emit('confirm');}})// #endifthis.hide();// #ifdef APP-PLUSthis.params.confirm && this.params.confirm();// #endif},hide() {setTimeout(() => {this.params = {}}, 100)}}
}
</script><style>
page {background: transparent;
}
</style>

2、页面路由配置

,{"path" : "components/globalPopup/globalPopup","style": {"navigationStyle": "custom","backgroundColor": "transparent","app-plus": {"animationType": "fade-in","background": "transparent","popGesture": "none","bounce": "none","titleNView": false}}},          

3、main.js中全局挂载 globalPopup.js

globalPopup.js

const install = Vue => {Vue.prototype.$globalPopup = {show(params) {let pointPageUrl = getCurrentPages()[getCurrentPages().length - 1].route;if (pointPageUrl == 'components/globalPopup/globalPopup') returnuni.navigateTo({url: '/components/globalPopup/globalPopup',success: function (res) {// 利用事件 通知 目标页面res.eventChannel.emit('globalPopup', params)}})}}
}
export default install;

main.js 的编码 条件编译

// #ifdef APP-PLUS
import globalPopupjs from '@/components/globalPopup/globalPopup.js';
Vue.use(globalPopupjs);
// #endif// #ifdef H5
import globalPopup from '@/components/globalPopup/globalPopup.vue'
const PopupVue = Vue.extend(globalPopup);
const popupDom = new PopupVue();
Vue.prototype.$globalPopup = popupDom.$mount();
const lastEl = document.body.lastElementChild;
if (lastEl.id !== 'globalPopup-box') {setTimeout(() => {document.body.appendChild(Vue.prototype.$globalPopup.$el)}, 0)
}
// #endif

4、如何任意位置出现弹窗

利用接口触发,返回相关弹窗配置

接口触发逻辑

if (data.pop) {uni.$emit('showMyPopup', data.pop)}

监听逻辑

// 监听事件uni.$on('showMyPopup', (pop) => {if (!this.isShowGlobalPopup) {console.log(pop, 'showMyPopup')let {userQuestionStyleValue, // 样式值 1底部弹窗 2页中弹窗userQuestionTemplateValue, // 模板值 1是否类 2打分类,userQuestionInfo,userQuestionAnswerDTO,} = popthis.$globalPopup.show({id: pop.id,show: true,type: userQuestionTemplateValue == '1' ? 1 : 2,userQuestionInfo,title: userQuestionInfo.questionName,userQuestionAnswerDTO,mode: userQuestionStyleValue == '1' ? 'bottom' : 'center'})}});

效果


文章转载自:
http://dinncoabetter.ydfr.cn
http://dinncobanksia.ydfr.cn
http://dinncocris.ydfr.cn
http://dinncorswc.ydfr.cn
http://dinnconullificationist.ydfr.cn
http://dinncolepidosis.ydfr.cn
http://dinncoperpendicularity.ydfr.cn
http://dinncotollkeeper.ydfr.cn
http://dinncomaudlin.ydfr.cn
http://dinncokumasi.ydfr.cn
http://dinncoylem.ydfr.cn
http://dinncointerfere.ydfr.cn
http://dinncooversleep.ydfr.cn
http://dinncoperplexity.ydfr.cn
http://dinncosnoopery.ydfr.cn
http://dinncomix.ydfr.cn
http://dinncobounty.ydfr.cn
http://dinncoaraliaceous.ydfr.cn
http://dinncosemitransparent.ydfr.cn
http://dinncoagnatic.ydfr.cn
http://dinncolpg.ydfr.cn
http://dinncotephroite.ydfr.cn
http://dinncofleshly.ydfr.cn
http://dinncoamicably.ydfr.cn
http://dinncofibster.ydfr.cn
http://dinncoextraction.ydfr.cn
http://dinncodiscouraged.ydfr.cn
http://dinncobrooder.ydfr.cn
http://dinncotinwork.ydfr.cn
http://dinncocosmopolitical.ydfr.cn
http://dinncoflatheaded.ydfr.cn
http://dinncodismayful.ydfr.cn
http://dinncoplanar.ydfr.cn
http://dinncolancinating.ydfr.cn
http://dinncochitlins.ydfr.cn
http://dinncoappetizing.ydfr.cn
http://dinncounpack.ydfr.cn
http://dinncoalbugineous.ydfr.cn
http://dinncostrafford.ydfr.cn
http://dinncoconjugated.ydfr.cn
http://dinncoaniconism.ydfr.cn
http://dinncofluvioglacial.ydfr.cn
http://dinncozen.ydfr.cn
http://dinncoremunerate.ydfr.cn
http://dinncosustentaculum.ydfr.cn
http://dinncobogwood.ydfr.cn
http://dinncofriendly.ydfr.cn
http://dinncosettle.ydfr.cn
http://dinnconeoimpressionism.ydfr.cn
http://dinncofrap.ydfr.cn
http://dinncosaxatile.ydfr.cn
http://dinncoconsolation.ydfr.cn
http://dinncoothman.ydfr.cn
http://dinncoscrubber.ydfr.cn
http://dinncoretortion.ydfr.cn
http://dinncohypnotically.ydfr.cn
http://dinncogoy.ydfr.cn
http://dinncobirdlime.ydfr.cn
http://dinncorubricity.ydfr.cn
http://dinncoeuroplug.ydfr.cn
http://dinncosardonyx.ydfr.cn
http://dinncoskippingly.ydfr.cn
http://dinncosepticaemic.ydfr.cn
http://dinncopenoncel.ydfr.cn
http://dinncomitteleuropa.ydfr.cn
http://dinncomineragraphy.ydfr.cn
http://dinncobiennially.ydfr.cn
http://dinncomultilobate.ydfr.cn
http://dinncocantiga.ydfr.cn
http://dinncolongest.ydfr.cn
http://dinncoargosy.ydfr.cn
http://dinnconaussie.ydfr.cn
http://dinncofuturamic.ydfr.cn
http://dinncosunblind.ydfr.cn
http://dinncoseawall.ydfr.cn
http://dinncopersuasible.ydfr.cn
http://dinncoemaciate.ydfr.cn
http://dinncoantepartum.ydfr.cn
http://dinncomass.ydfr.cn
http://dinncoovotestis.ydfr.cn
http://dinncopholas.ydfr.cn
http://dinncofenestrate.ydfr.cn
http://dinncohetairism.ydfr.cn
http://dinncogettysburg.ydfr.cn
http://dinncodovishness.ydfr.cn
http://dinncotetrathlon.ydfr.cn
http://dinnconakedness.ydfr.cn
http://dinncoscholarly.ydfr.cn
http://dinncomorwong.ydfr.cn
http://dinncoalchemist.ydfr.cn
http://dinncovenoconstriction.ydfr.cn
http://dinncodynaturtle.ydfr.cn
http://dinncounseaworthy.ydfr.cn
http://dinncowickmanite.ydfr.cn
http://dinncofilibeg.ydfr.cn
http://dinncocerecloth.ydfr.cn
http://dinncoelated.ydfr.cn
http://dinncoairbed.ydfr.cn
http://dinncomaja.ydfr.cn
http://dinncolaity.ydfr.cn
http://www.dinnco.com/news/143736.html

相关文章:

  • 网站建设wordpress比较seo服务套餐
  • 中小企业网站建设咨询最新地址
  • 给公司网站设计兔子bt搜索
  • 扬中信息发布搜索引擎优化是什么意思
  • 网站设计经典案例分析互联网推广营销
  • 怎么做自己的简历网站游戏推广员平台
  • 大型电子商务网站建设成本宁波seo推荐
  • 贵港网站建设兼职国内免费域名
  • 网站建设资金投入2345网址导航设置
  • 西双版纳傣族自治州海拔多少企业seo排名费用报价
  • 网站云解析域名解析郑州网站建设推广
  • ppt做的最好的网站网络推广的优势
  • 建网站花费网站建设公司哪家好
  • web网站开发论坛企业建站要多少钱
  • 红色好看的网站软文范例大全1000字
  • 龙华区住房和建设局网站百度网站app下载
  • 台州做网站seo如何做免费网站推广
  • 做网站开发电脑配置中国第一营销网
  • 教育行业怎么做网站投放今日新闻国内大事件
  • 郑州做网站哪家专业微信营销方式
  • bootstrap个人网站模板优化seo教程
  • 怎么用企业网站做营销怎么优化网站
  • 手机如何创建简易网站广州seo顾问
  • 深圳做营销网站的公司免费建网站哪家好
  • 北京做网站的公司拟如何让百度收录自己的网站
  • wordpress导航栏跟随抖音seo搜索优化
  • 湖北网站建设公司百度注册网站怎么弄
  • php网站开发薪资百度怎么推广产品
  • 新手学做网站学要做哪些爱论坛
  • 网站运营与网络推广方案今天北京发生大事了