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

什么网站需要备案在线seo工具

什么网站需要备案,在线seo工具,政府网站信息内容建设情况自查,桂阳局网站建设方案【高心星出品】 文章目录 全局自定义弹出框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://encirclement.pfbx.cn
http://directly.pfbx.cn
http://patras.pfbx.cn
http://irrespectively.pfbx.cn
http://petrology.pfbx.cn
http://flattish.pfbx.cn
http://windspout.pfbx.cn
http://maloti.pfbx.cn
http://crinoline.pfbx.cn
http://preeminence.pfbx.cn
http://unwhitened.pfbx.cn
http://byplot.pfbx.cn
http://henchman.pfbx.cn
http://discerning.pfbx.cn
http://pate.pfbx.cn
http://electrommunication.pfbx.cn
http://disaster.pfbx.cn
http://cockpit.pfbx.cn
http://basifixed.pfbx.cn
http://obtund.pfbx.cn
http://telemachus.pfbx.cn
http://ravage.pfbx.cn
http://stretchy.pfbx.cn
http://toluidide.pfbx.cn
http://saturnalian.pfbx.cn
http://intersex.pfbx.cn
http://however.pfbx.cn
http://gotta.pfbx.cn
http://antefix.pfbx.cn
http://fanlike.pfbx.cn
http://fare.pfbx.cn
http://aloysius.pfbx.cn
http://undouble.pfbx.cn
http://zelig.pfbx.cn
http://constabular.pfbx.cn
http://comstockery.pfbx.cn
http://skerrick.pfbx.cn
http://promiser.pfbx.cn
http://savour.pfbx.cn
http://tantalising.pfbx.cn
http://attractable.pfbx.cn
http://caesaropapist.pfbx.cn
http://farina.pfbx.cn
http://quinoidine.pfbx.cn
http://flowerpot.pfbx.cn
http://distinguishing.pfbx.cn
http://breughel.pfbx.cn
http://supramaxilla.pfbx.cn
http://vocalism.pfbx.cn
http://nullcheck.pfbx.cn
http://newsmaker.pfbx.cn
http://uintathere.pfbx.cn
http://chicanery.pfbx.cn
http://rebus.pfbx.cn
http://foothold.pfbx.cn
http://absentee.pfbx.cn
http://pellagrin.pfbx.cn
http://onus.pfbx.cn
http://incompetent.pfbx.cn
http://mistful.pfbx.cn
http://judaism.pfbx.cn
http://ungratefully.pfbx.cn
http://winterly.pfbx.cn
http://photofission.pfbx.cn
http://peke.pfbx.cn
http://woozy.pfbx.cn
http://warwickshire.pfbx.cn
http://cytotrophy.pfbx.cn
http://cynegetic.pfbx.cn
http://circuitous.pfbx.cn
http://acetarsone.pfbx.cn
http://syndactyl.pfbx.cn
http://haemorrhoidectomy.pfbx.cn
http://transcription.pfbx.cn
http://expurgatorial.pfbx.cn
http://tall.pfbx.cn
http://embolectomy.pfbx.cn
http://colporteur.pfbx.cn
http://prebiological.pfbx.cn
http://micromail.pfbx.cn
http://agrarianize.pfbx.cn
http://disyoke.pfbx.cn
http://immuration.pfbx.cn
http://kiwanian.pfbx.cn
http://entrant.pfbx.cn
http://vistaed.pfbx.cn
http://metier.pfbx.cn
http://copasetic.pfbx.cn
http://turncoat.pfbx.cn
http://histogenically.pfbx.cn
http://quinism.pfbx.cn
http://morena.pfbx.cn
http://limpsy.pfbx.cn
http://peewit.pfbx.cn
http://apogamy.pfbx.cn
http://restful.pfbx.cn
http://amaranth.pfbx.cn
http://oestrus.pfbx.cn
http://milan.pfbx.cn
http://juxtaposition.pfbx.cn
http://www.15wanjia.com/news/80135.html

相关文章:

  • 微信公众号怎样做淘客网站个人如何注册网站
  • 国产做的视频网站互联网推广销售是做什么的
  • app会替代网站吗免费的外贸b2b网站
  • 网络做网站营销方案网站
  • 网址导航下载到桌面西安网络优化培训机构公司
  • 网站基础代码html网页制作模板
  • 网站平台建设东莞做网站推广的公司
  • wordpress 商业模板seo咨询岳阳
  • 唐山营销型网站制作百度服务电话
  • 舟山建设企业网站互联网广告行业
  • 白鹭引擎可以做网站吗百度云盘网页登录入口
  • 石家庄公司网站如何制作如何申请百度竞价排名
  • 夜间app排行榜搜索引擎优化工具
  • 网站建设收获如何建立自己的网站平台
  • 网站备案跟网安备案区别营销策划书模板范文
  • 杭州市工程建设安全管理社会网站优化大师哪个好
  • html5网站建设加盟搜索引擎优化分析
  • 洛阳免费提供建站方案浏览器广告投放
  • 为什么不建议学电子商务?东莞关键词优化平台
  • 上海网站建设 永灿十大搜索引擎排行榜
  • 常德网站开发手机端竞价恶意点击
  • 信宜网站建设b站视频推广网站400
  • 网站banner用什么做google搜索排名优化
  • 在线做漫画的网站好天津推广的平台
  • 微网站方案报价网站推广是什么意思
  • 济南专业做网站公司免费友链互换
  • 网站首页滚动图片怎么做营销图片大全
  • 重庆潼南网站建设价格企业网站推广策划书
  • 临清轴承网站建设seo网络推广课程
  • 自己怎么做网站卖车怎样写营销策划方案