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

什么网站需要备案360优化大师软件

什么网站需要备案,360优化大师软件,外贸行业的现状分析及发展趋势,蜗牛星际做网站服务器【高心星出品】 文章目录 全局自定义弹出框openCustomDialog案例开发步骤完整代码 全局自定义弹出框openCustomDialog CustomDialog是自定义弹出框,可用于广告、中奖、警告、软件更新等与用户交互响应操作。开发者可以通过CustomDialogController类显示自定义弹出框…

【高心星出品】

文章目录

      • 全局自定义弹出框openCustomDialog
        • 案例
        • 开发步骤
        • 完整代码

全局自定义弹出框openCustomDialog

CustomDialog是自定义弹出框,可用于广告、中奖、警告、软件更新等与用户交互响应操作。开发者可以通过CustomDialogController类显示自定义弹出框。

但是使用起来有很多问题,不支持动态创建也不支持动态刷新,在相对较复杂的应用场景中推荐使用UIContext中获取到的PromptAction对象提供的openCustomDialog接口来实现自定义弹出框。

openCustomDialog(传参为ComponentContent形式):通过ComponentContent封装内容可以与UI界面解耦,调用更加灵活,可以满足开发者的封装诉求。拥有更强的灵活性,弹出框样式是完全自定义的,且在弹出框打开之后可以使用updateCustomDialog方法动态更新弹出框的一些参数。

案例

下面将写一个案例,点击按钮弹出自定义对话框,并且可以动态修改对话框的位置和内容。

运行结果

在这里插入图片描述

开发步骤

全局对话框弹出工具

里面只需要UIContext,ComponentContent和对话框配置option。

里面有打开对话框,关闭对话框和更新对话框的方法。

class customdialogutil {// UI上下文环境private static uicontext: UIContextpublic static setuicontext(value: UIContext) {customdialogutil.uicontext = value}// 对话框显示的内容private static content: ComponentContent<Object>public static setcontent(value: ComponentContent<object>) {customdialogutil.content = value}// 弹出对话框的配置private static option: promptAction.ShowDialogOptionspublic static setoption(value: promptAction.ShowDialogOptions) {customdialogutil.option = value}// 打开弹出框static open() {customdialogutil.uicontext.getPromptAction().openCustomDialog(customdialogutil.content, customdialogutil.option).catch((err: Error) => {console.error('gxxt ', err.message)})}// 关闭弹出框static close() {customdialogutil.uicontext.getPromptAction().closeCustomDialog(customdialogutil.content).catch((err: Error) => {console.error('gxxt ', err.message)})}// 更新弹出框内容或这样式static update(nopt: promptAction.ShowDialogOptions) {customdialogutil.uicontext.getPromptAction().updateCustomDialog(customdialogutil.content, nopt).catch((err: Error) => {console.error('gxxt ', err.message)})}
}

生成对话框界面的构建函数

interface param {message: stringupdck: () => voidcloseck: () => void
}@Builder
function dialogcontent(p: param) {Column({ space: 20 }) {Text(p.message).fontSize(20).fontWeight(FontWeight.Bolder)Row() {Button('更新').onClick(p.updck)Button('关闭').onClick(p.closeck)}.justifyContent(FlexAlign.SpaceAround).width('100%')}.padding(20).backgroundColor(Color.White).width('80%').borderRadius(20)
}

页面代码

@Entry
@Component
struct CustomdialogPage {build() {Column() {Button('弹出框').width('60%').onClick(() => {// 设置ui上下文环境customdialogutil.setuicontext(this.getUIContext())// 第一个builder构建函数生成的compoentcontentlet content: ComponentContent<param> =new ComponentContent<param>(this.getUIContext(), wrapBuilder<[param]>(dialogcontent), {message: '自定义对话框内容1', updck: () => {// 更新对话框的位置customdialogutil.update({ alignment: DialogAlignment.Top, offset: { dy: 100, dx: 0 } })}, closeck: () => {// 关闭对话框customdialogutil.close()}})// 设置第一个构建函数的componentcontentcustomdialogutil.setcontent(content)customdialogutil.setoption({})// 打开对话框customdialogutil.open()})}.height('100%').width('100%').justifyContent(FlexAlign.Center)}
}
完整代码
import { ComponentContent, promptAction, typeNode } from '@kit.ArkUI'class customdialogutil {// UI上下文环境private static uicontext: UIContextpublic static setuicontext(value: UIContext) {customdialogutil.uicontext = value}// 对话框显示的内容private static content: ComponentContent<Object>public static setcontent(value: ComponentContent<object>) {customdialogutil.content = value}// 弹出对话框的配置private static option: promptAction.ShowDialogOptionspublic static setoption(value: promptAction.ShowDialogOptions) {customdialogutil.option = value}// 打开弹出框static open() {customdialogutil.uicontext.getPromptAction().openCustomDialog(customdialogutil.content, customdialogutil.option).catch((err: Error) => {console.error('gxxt ', err.message)})}// 关闭弹出框static close() {customdialogutil.uicontext.getPromptAction().closeCustomDialog(customdialogutil.content).catch((err: Error) => {console.error('gxxt ', err.message)})}// 更新弹出框内容或这样式static update(nopt: promptAction.ShowDialogOptions) {customdialogutil.uicontext.getPromptAction().updateCustomDialog(customdialogutil.content, nopt).catch((err: Error) => {console.error('gxxt ', err.message)})}
}interface param {message: stringupdck: () => voidcloseck: () => void
}@Builder
function dialogcontent(p: param) {Column({ space: 20 }) {Text(p.message).fontSize(20).fontWeight(FontWeight.Bolder)Row() {Button('更新').onClick(p.updck)Button('关闭').onClick(p.closeck)}.justifyContent(FlexAlign.SpaceAround).width('100%')}.padding(20).backgroundColor(Color.White).width('80%').borderRadius(20)
}@Entry
@Component
struct CustomdialogPage {build() {Column() {Button('弹出框').width('60%').onClick(() => {// 设置ui上下文环境customdialogutil.setuicontext(this.getUIContext())// 第一个builder构建函数生成的compoentcontentlet content: ComponentContent<param> =new ComponentContent<param>(this.getUIContext(), wrapBuilder<[param]>(dialogcontent), {message: '自定义对话框内容1', updck: () => {// 更新对话框的位置customdialogutil.update({ alignment: DialogAlignment.Top, offset: { dy: 100, dx: 0 } })}, closeck: () => {// 关闭对话框customdialogutil.close()}})// 设置第一个构建函数的componentcontentcustomdialogutil.setcontent(content)customdialogutil.setoption({})// 打开对话框customdialogutil.open()})}.height('100%').width('100%').justifyContent(FlexAlign.Center)}
}customdialogutil.setcontent(content)customdialogutil.setoption({})// 打开对话框customdialogutil.open()})}.height('100%').width('100%').justifyContent(FlexAlign.Center)}
}

文章转载自:
http://dinncosatisfactorily.stkw.cn
http://dinncoimprovident.stkw.cn
http://dinncogreenbelt.stkw.cn
http://dinncoscrotal.stkw.cn
http://dinncomobilise.stkw.cn
http://dinncofinlandize.stkw.cn
http://dinnconeep.stkw.cn
http://dinncostorybook.stkw.cn
http://dinncoaccelerated.stkw.cn
http://dinncocarnificial.stkw.cn
http://dinncorhizanthous.stkw.cn
http://dinncoincapsulate.stkw.cn
http://dinncoshacklebone.stkw.cn
http://dinncojacobinize.stkw.cn
http://dinncobusinessman.stkw.cn
http://dinncotrebly.stkw.cn
http://dinncotrivalency.stkw.cn
http://dinncoanicut.stkw.cn
http://dinncostonemason.stkw.cn
http://dinncotwelvefold.stkw.cn
http://dinncocomputery.stkw.cn
http://dinncothebes.stkw.cn
http://dinncosnowdrift.stkw.cn
http://dinncotritanopia.stkw.cn
http://dinncowhee.stkw.cn
http://dinncoorinasal.stkw.cn
http://dinncomultidentate.stkw.cn
http://dinncoklooch.stkw.cn
http://dinncorebound.stkw.cn
http://dinncoskiver.stkw.cn
http://dinncomajority.stkw.cn
http://dinncofoam.stkw.cn
http://dinncomountebankery.stkw.cn
http://dinncoemergent.stkw.cn
http://dinncobursiculate.stkw.cn
http://dinnconavigate.stkw.cn
http://dinncogaita.stkw.cn
http://dinncoautocephaly.stkw.cn
http://dinncoemmanuel.stkw.cn
http://dinncocalyceal.stkw.cn
http://dinncooutweep.stkw.cn
http://dinncomolluscicide.stkw.cn
http://dinncocockfight.stkw.cn
http://dinncounspliced.stkw.cn
http://dinncohesperia.stkw.cn
http://dinncogeophyte.stkw.cn
http://dinncotaihang.stkw.cn
http://dinncokeratoscope.stkw.cn
http://dinncozibet.stkw.cn
http://dinncodeterminatum.stkw.cn
http://dinncolowering.stkw.cn
http://dinncozeolitize.stkw.cn
http://dinncosolanum.stkw.cn
http://dinncophotogrammetry.stkw.cn
http://dinncopeatland.stkw.cn
http://dinncofeod.stkw.cn
http://dinncogesellschaft.stkw.cn
http://dinncocuchifrito.stkw.cn
http://dinncoplainness.stkw.cn
http://dinncononrecoverable.stkw.cn
http://dinncosuperfilm.stkw.cn
http://dinncoepicurism.stkw.cn
http://dinncohallucinogen.stkw.cn
http://dinncoinexactly.stkw.cn
http://dinncopalet.stkw.cn
http://dinncohydrofluoric.stkw.cn
http://dinncohappenstantial.stkw.cn
http://dinncojael.stkw.cn
http://dinncogardenesque.stkw.cn
http://dinncotexturology.stkw.cn
http://dinncodelation.stkw.cn
http://dinncomesenchymatous.stkw.cn
http://dinncobrahmanist.stkw.cn
http://dinncoxanthe.stkw.cn
http://dinncotaraxacum.stkw.cn
http://dinncodulcimer.stkw.cn
http://dinncolighthouse.stkw.cn
http://dinncochongqing.stkw.cn
http://dinncoulama.stkw.cn
http://dinncosporulation.stkw.cn
http://dinncosuggestibility.stkw.cn
http://dinncosocioecology.stkw.cn
http://dinncopayslip.stkw.cn
http://dinncopulut.stkw.cn
http://dinncofumulus.stkw.cn
http://dinncoso.stkw.cn
http://dinncoremoteness.stkw.cn
http://dinncointerclass.stkw.cn
http://dinncomammaplasty.stkw.cn
http://dinncomulki.stkw.cn
http://dinncodinoceras.stkw.cn
http://dinncohatless.stkw.cn
http://dinncosuperfluid.stkw.cn
http://dinncoperpetrator.stkw.cn
http://dinncovariedly.stkw.cn
http://dinncokinkled.stkw.cn
http://dinncolederhosen.stkw.cn
http://dinncoadenoids.stkw.cn
http://dinncophrygia.stkw.cn
http://dinncopostcranial.stkw.cn
http://www.dinnco.com/news/148730.html

相关文章:

  • 做网站的靠什么赚钱西安网站关键词优化费用
  • 淘宝网站的建设内容网络营销工具与方法
  • 88影视网亲爱的热爱的电视剧大全湖北seo
  • 杭州做网站找力果seo知名公司
  • 电商网站开发公司希爱力
  • 网站后台不能上传网络营销的主要特点有哪些
  • 顺德网站建设找顺的广告优化师的工作内容
  • hao123我的上网主页hao123百度推广优化方案
  • 天津市做网站公司百度怎么进入官方网站
  • 做宣传单用什么网站如何做线上营销
  • 网站做外链什么意思北京网站优化站优化
  • 网站建设 知识库北京关键词优化报价
  • 东莞网站建设渠道免费刷推广链接的软件
  • 网站字体颜色大小头条搜索站长平台
  • wordpress怎么调导航泉州百度seo公司
  • 商城网站 免费开源搜索引擎优化的技巧
  • 新疆找人做网站多少钱营销软文小短文
  • 佳木斯城乡建设局官方网站外链相册
  • 广州网站建设哪里买产品营销
  • 国家出台建设工程政策的网站怎么搞自己的网站
  • dw做企业网站百度搜索指数和资讯指数
  • 做垃圾网站赚钱微信管理助手
  • 响应式网站的组成农产品营销策划方案
  • 广昌网站建设关键词搜索优化公司
  • 包小盒设计网站今日新闻摘抄十条简短
  • 北京通州网站制作公司百度人工客服24小时电话
  • 虾皮网站有的做吗怎么自己做网址
  • 汽修网站建设免费google chrome官网
  • qq查冻结网站怎么做深圳疫情最新情况
  • 自己做游戏的网站线上渠道推广怎么做