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

做网站的人会不会拿走我的网站免费网页制作平台

做网站的人会不会拿走我的网站,免费网页制作平台,比较有名的网站建设平台,wordpress注册取消邮箱文章目录 1、简介2、效果3、在ArkTs上全屏Web3.1、创建ArkTS应用3.2、修改模块化配置(module.json5)3.3、修改系统栏控制(ArkTS代码) 4、双网页嵌套Web实现5、ArkTSWeb技术架构的演进 1、简介 在鸿蒙应用开发领域,技术…

文章目录

  • 1、简介
  • 2、效果
  • 3、在ArkTs上全屏Web
    • 3.1、创建ArkTS应用
    • 3.2、修改模块化配置(module.json5)
    • 3.3、修改系统栏控制(ArkTS代码)
  • 4、双网页嵌套Web实现
  • 5、ArkTS+Web技术架构的演进

1、简介

在鸿蒙应用开发领域,技术选型的迭代速度令人瞩目。继昨日完成Vue框架的鸿蒙HelloWorld实践后,今日笔者深度体验了ArkTS+Web组件的开发范式,成功构建了一个支持双网页嵌套的全屏应用。本文将完整复现开发过程,重点解析全屏实现、网页嵌套等核心技术要点。

2、效果

在这里插入图片描述

3、在ArkTs上全屏Web

3.1、创建ArkTS应用

同样采用DevEco的IDE创建应用,可以参考我上一篇文章《【Web】使用Vue3开发鸿蒙的HelloWorld!》。

3.2、修改模块化配置(module.json5)

可以参考我的应用路径
在这里插入图片描述

修改module.json5源码如下:

{"module": {"name": "entry","type": "entry","description": "$string:module_desc","mainElement": "EntryAbility","deviceTypes": ["phone"],"deliveryWithInstall": true,"installationFree": false,"pages": "$profile:main_pages","abilities": [{"name": "EntryAbility","srcEntry": "./ets/entryability/EntryAbility.ts","description": "$string:EntryAbility_desc","icon": "$media:icon","label": "$string:EntryAbility_label","startWindowIcon": "$media:icon","startWindowBackground": "$color:start_window_background","exported": true,"skills": [{"entities": ["entity.system.home"],"actions": ["action.system.home"]}]}],}
}

3.3、修改系统栏控制(ArkTS代码)

可以参考我的应用路径
在这里插入图片描述
修改Index.ets源码如下:

import web_webview from '@ohos.web.webview'
import window from '@ohos.window'
import common from '@ohos.app.ability.common'@Entry
@Component
struct WebPage {controller: web_webview.WebviewController = new web_webview.WebviewController()private context = getContext(this) as common.Contextasync aboutToAppear() {try {// 获取窗口对象并设置全屏const win = await window.getLastWindow(this.context)// 核心配置:全屏+隐藏系统栏await win.setWindowLayoutFullScreen(true)await win.setWindowSystemBarEnable([])// 设置状态栏完全透明(防止出现白条)await win.setWindowSystemBarProperties({statusBarColor: '#00000000',navigationBarColor: '#00000000',statusBarContentColor: '#FF000000' // 状态栏图标颜色})// 禁用边缘手势(可选)await win.setWindowTouchable(false)} catch (err) {console.error('全屏配置失败:', JSON.stringify(err))}}build() {Column() {Web({src: $rawfile("index.html"),controller: this.controller}).width('100%').height('100%').zoomAccess(false).fileAccess(true).domStorageAccess(true).initialScale(100)}.width('100%').height('100%').backgroundColor(Color.White)}
}

4、双网页嵌套Web实现

我把应用程序的Web放在rawfile目录下的index.html中
可以参考我的源码:

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>底部导航切换</title><style>* {margin: 0;padding: 0;box-sizing: border-box;touch-action: manipulation;}body {font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;background: #f8f9fa;padding-bottom: 80px; /* 为底部导航预留空间 */}/* 内容区域 */.content-container {padding: 15px;margin-top: 10px;transition: all 0.3s;}#contentFrame {width: 100%;height: calc(100vh - 140px);border: 2px solid #dee2e6;border-radius: 16px;background: white;}/* 底部导航栏样式 */.nav-bar {display: flex;gap: 8px;padding: 12px;background: white;box-shadow: 0 -2px 4px rgba(0,0,0,0.08);position: fixed;bottom: 0;left: 0;right: 0;z-index: 100;border-top-left-radius: 24px;border-top-right-radius: 24px;}.nav-btn {flex: 1;padding: 12px 0;border: none;border-radius: 24px;background: #e9ecef;font-size: 16px;transition: all 0.3s;cursor: pointer;}.nav-btn:hover {background: #007bff;color: white;}.nav-btn.active {background: #007bff;color: white;transform: scale(0.95);}/* 移动端适配 */@media (max-width: 768px) {.nav-btn {padding: 10px 0;font-size: 14px;}#contentFrame {height: calc(100vh - 120px);}body {padding-bottom: 70px;}}</style>
</head>
<body>
<div class="content-container"><iframe id="contentFrame" src="https://shazhenyu.blog.csdn.net/" frameborder="0"></iframe>
</div><nav class="nav-bar"><button class="nav-btn active" onclick="switchTab('csdn')">📝 我的博客</button><button class="nav-btn" onclick="switchTab('baidu')">🔍 手机百度</button>
</nav><script>function switchTab(target) {const frame = document.getElementById('contentFrame');const buttons = document.querySelectorAll('.nav-btn');// 切换按钮状态buttons.forEach(btn => btn.classList.remove('active'));event.target.classList.add('active');// 切换内容const urls = {csdn: 'https://shazhenyu.blog.csdn.net/',baidu: 'https://m.baidu.com'};frame.src = urls[target];// 特殊页面适配if(target === 'csdn') {frame.style.height = 'calc(100vh - 140px)';document.body.style.backgroundColor = '#f8f9fa';} else {frame.style.height = 'calc(100vh - 140px)';document.body.style.backgroundColor = '#ffffff';}}// 初始化加载CSDNwindow.onload = () => {const frame = document.getElementById('contentFrame');frame.addEventListener('load', () => {// CSDN页面特殊处理if(frame.src.includes('csdn.net')) {frame.style.height = 'calc(100vh - 140px)';}});};// 窗口尺寸变化处理window.addEventListener('resize', () => {const frame = document.getElementById('contentFrame');frame.style.height = window.innerWidth > 768? 'calc(100vh - 140px)': 'calc(100vh - 120px)';});</script>
</body>
</html>

5、ArkTS+Web技术架构的演进

相较于传统Web开发模式,ArkTS+Web的融合方案展现出三大优势:

  • 原生性能增强:通过ArkTS声明式UI框架与Web组件的混编,既保留了Web生态的灵活性,又获得了接近原生应用的流畅度
  • 开发效率提升:一套代码同时适配手机、平板等多端设备,相较传统跨平台方案缩减约40%的适配成本
  • 系统级能力接入:可直接调用鸿蒙系统API,实现全屏显示、系统栏控制等原生功能
http://www.dtcms.com/wzjs/383264.html

相关文章:

  • 餐饮网站建设背景百度信息流怎么投放
  • 烟台网站建设哪家好竞价培训班
  • 烟台专业做网站公司百度快照优化公司
  • 南浔建设局网站营销型网站建设的价格
  • 企业商城网站建设价格国内seo排名
  • 哪些h5网站比较好刷推广链接人数的软件
  • 做的网站有广告图片微信小程序官网
  • 全国有名的网站建设公司北京网站推广服务
  • 软件技术开发网站seo基础
  • 保定网站建设公司谷歌搜索引擎google
  • 书城网站建设规划书深圳seo顾问
  • 苏州做网站中国站长之家网站
  • 好的建设网站公司奉节县关键词seo排名优化
  • 免费建站网站一级大录像不卡在线看网站宣传的方法有哪些
  • 重庆seo整站优化效果北京网站优化外包
  • 南京医院网站建设优化大师有必要安装吗
  • 镜湖区城乡建设委员会网站常见的网站推广方法有哪些
  • 设计素材网站版权seo优化排名易下拉用法
  • 网站必须做ipv6google框架三件套
  • 不适合做设计的人seo怎么收费seo
  • 泉州seo网站推广免费数据查询网站
  • 怎样用dw做网站主页百度seo引流
  • 杭州做网站建设深圳全网推广排名
  • 天津网站域名购买百度手机助手应用商店
  • 90设计下载后怎么用seo学堂
  • 建筑公司网站平台百度关键词竞价
  • 网站怎么做区域性优化seo云优化
  • 优秀网站专题太原seo哪家好
  • 十大资本投资公司武汉seo工厂
  • 找程序员代写程序搜索引擎优化的含义