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

微信网站建设多少钱b2b网站大全

微信网站建设多少钱,b2b网站大全,买极速赛车网站会动手做不,个人可以建设哪些网站目录: 1、简介&使用场景2、加载网络页面3、加载本地页面4、加载HTML格式的文本数据5、设置深色模式6、上传文件7、在新窗口中打开页面8、管理位置权限 1、简介&使用场景 Web是一种基于互联网的技术和资源的网络服务系统。它是指由许多互连的计算机组成的全…

目录:

    • 1、简介&使用场景
    • 2、加载网络页面
    • 3、加载本地页面
    • 4、加载HTML格式的文本数据
    • 5、设置深色模式
    • 6、上传文件
    • 7、在新窗口中打开页面
    • 8、管理位置权限

1、简介&使用场景

Web是一种基于互联网的技术和资源的网络服务系统。它是指由许多互连的计算机组成的全球性计算机网络,使用户能够通过浏览器访问和交互式使用各种信息和资源,如网页、文档、图片、视频、音频等。通过Web,用户可以浏览网页、发送电子邮件、参与在线社交网络、进行在线购物等各种活动。Web的核心技术包括超文本传输协议(HTTP),超文本标记语言(HTML)和统一资源定位器(URL)。

使用场景:
鸿蒙的应用有时需要集成别的项目H5等入口页面,如html等或者是网络地址的形式;这个就需要使用到鸿蒙加载html页面或者网络地址等。

2、加载网络页面

"requestPermissions": [{"name": "ohos.permission.INTERNET" // 使用网络权限}
]
import web_webview from '@ohos.web.webview'@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController()build() {Column() {Button('愚公博客首页').onClick(() => {try {// 点击按钮时,通过loadUrl,跳转到www.example1.comthis.controller.loadUrl('www.example1.com');} catch (error) {console.error(`ErrorCode: ${error.code},  Message: ${error.message}`);}})// 组件创建时,加载www.example.comWeb({ src: 'www.baidu.com', controller: this.controller})}}
}

3、加载本地页面

<!-- local.html -->
<!DOCTYPE html>
<html><body><p>Hello World</p></body>
</html>
// xxx.ets
import web_webview from '@ohos.web.webview';@Entry
@Component
struct WebComponent {webviewController: web_webview.WebviewController = new web_webview.WebviewController();build() {Column() {Button('loadUrl').onClick(() => {try {// 点击按钮时,通过loadUrl,跳转到local1.htmlthis.webviewController.loadUrl($rawfile("index.html"));} catch (error) {console.error(`ErrorCode: ${error.code},  Message: ${error.message}`);}})// 组件创建时,通过$rawfile加载本地文件local.htmlWeb({ src: $rawfile("index.html"), controller: this.webviewController })}}
}

4、加载HTML格式的文本数据

// xxx.ets
import web_webview from '@ohos.web.webview';@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController();build() {Column() {Button('loadData').onClick(() => {try {// 点击按钮时,通过loadData,加载HTML格式的文本数据this.controller.loadData("<html><body bgcolor=\"white\">Source:<pre>source</pre></body></html>","text/html","UTF-8");} catch (error) {console.error(`ErrorCode: ${error.code},  Message: ${error.message}`);}})// 组件创建时,加载www.example.comWeb({ src: 'www.example.com', controller: this.controller })}}
}

5、设置深色模式

通过darkMode()接口可以配置不同的深色模式。

  • WebDarkMode.Off模式表示关闭深色模式。
  • WebDarkMode.On表示开启深色模式,且深色模式跟随前端页面。
  • WebDarkMode.Auto表示开启深色模式,且深色模式跟随系统。
  • forceDarkAccess()接口可将前端页面强制配置深色模式,且深色模式不跟随前端页面和系统。配置该模式时候,需要将深色模式配置成WebDarkMode.On。
// xxx.ets
import web_webview from '@ohos.web.webview';@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController();@State mode: WebDarkMode = WebDarkMode.On;@State access: boolean = true;build() {Column() {Web({ src: 'www.example.com', controller: this.controller }).darkMode(this.mode).forceDarkAccess(this.access)}}
}

6、上传文件

<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>Document</title>
</head><body>
// 点击文件上传按钮
<input type="file" value="file"></br>
</body>
</html>
// xxx.ets
import web_webview from '@ohos.web.webview';
@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController()build() {Column() {// 加载本地local.html页面Web({ src: $rawfile('index.html'), controller: this.controller }).onShowFileSelector((event) => {// 开发者设置要上传的文件路径let fileList: Array<string> = ['xxx/test.png',]event.result.handleFileList(fileList)return true;})}}
}

7、在新窗口中打开页面

 <!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>WindowEvent</title>
</head>
<body>
<input type="button" value="新窗口中打开网页" onclick="OpenNewWindow()">
<script type="text/javascript">function OpenNewWindow(){let openedWindow = window.open("about:blank", "", "location=no,status=no,scrollvars=no");openedWindow.document.write("<p>这是我的新窗口</p>");openedWindow.focus();}
</script>
</body>
</html>

开发者可以使用multiWindowAccess()接口来设置网页是否可以在新窗口中打开。通过调用此接口并传入相应的参数,可以控制网页是否允许使用新窗口。

当网页请求在新窗口中打开时,应用将收到Web组件的新窗口事件,可以通过onWindowNew()接口来处理此事件。在此接口中,开发者可以根据需要创建新的窗口来处理Web组件的窗口请求。

// xxx.ets
import web_webview from '@ohos.web.webview'//在同一page页有两个web组件。在WebComponent新开窗口时,会跳转到NewWebViewComp。
@CustomDialog
struct NewWebViewComp {
controller?: CustomDialogController
webviewController1: web_webview.WebviewController = new web_webview.WebviewController()
build() {Column() {Web({ src: "", controller: this.webviewController1 }).javaScriptAccess(true).multiWindowAccess(false).onWindowExit(()=> {console.info("NewWebViewComp onWindowExit")if (this.controller) {this.controller.close()}})}}
}@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController()dialogController: CustomDialogController | null = nullbuild() {Column() {Web({ src:$rawfile("window.html"), controller: this.controller }).javaScriptAccess(true)//需要使能multiWindowAccess.multiWindowAccess(true).allowWindowOpenMethod(true).onWindowNew((event) => {if (this.dialogController) {this.dialogController.close()}let popController:web_webview.WebviewController = new web_webview.WebviewController()this.dialogController = new CustomDialogController({builder: NewWebViewComp({webviewController1: popController})})this.dialogController.open()//将新窗口对应WebviewController返回给Web内核。//如果不需要打开新窗口请调用event.handler.setWebController接口设置成null。//若不调用event.handler.setWebController接口,会造成render进程阻塞。event.handler.setWebController(popController)})}}
}

8、管理位置权限

<!DOCTYPE html>
<html>
<body>
<p id="locationInfo">位置信息</p>
<button onclick="getLocation()">获取位置</button>
<script>
var locationInfo=document.getElementById("locationInfo");
function getLocation(){if (navigator.geolocation) {<!-- 前端页面访问设备地理位置 -->navigator.geolocation.getCurrentPosition(showPosition);}
}
function showPosition(position){locationInfo.innerHTML="Latitude: " + position.coords.latitude + "<br />Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
// xxx.ets
import web_webview from '@ohos.web.webview';@Entry
@Component
struct WebComponent {controller: web_webview.WebviewController = new web_webview.WebviewController();build() {Column() {Web({ src:$rawfile('getLocation.html'), controller:this.controller }).geolocationAccess(true).onGeolocationShow((event) => {  // 地理位置权限申请通知AlertDialog.show({title: '位置权限请求',message: '是否允许获取位置信息',primaryButton: {value: 'cancel',action: () => {event.geolocation.invoke(event.origin, false, false);   // 不允许此站点地理位置权限请求}},secondaryButton: {value: 'ok',action: () => {event.geolocation.invoke(event.origin, true, false);    // 允许此站点地理位置权限请求}},cancel: () => {event.geolocation.invoke(event.origin, false, false);   // 不允许此站点地理位置权限请求}})})}}
}

文章转载自:
http://senseful.rywn.cn
http://priory.rywn.cn
http://corrigenda.rywn.cn
http://poussie.rywn.cn
http://brow.rywn.cn
http://itr.rywn.cn
http://tricarpellate.rywn.cn
http://novelistic.rywn.cn
http://sclerodactylia.rywn.cn
http://erring.rywn.cn
http://yttrotungstite.rywn.cn
http://apollo.rywn.cn
http://hardbake.rywn.cn
http://detectivism.rywn.cn
http://immunologist.rywn.cn
http://radioecology.rywn.cn
http://glucocorticoid.rywn.cn
http://deconstruction.rywn.cn
http://ornithomancy.rywn.cn
http://arrivederci.rywn.cn
http://staminal.rywn.cn
http://slighting.rywn.cn
http://stylish.rywn.cn
http://hupeh.rywn.cn
http://flaky.rywn.cn
http://franklin.rywn.cn
http://addenda.rywn.cn
http://waterfall.rywn.cn
http://tell.rywn.cn
http://brachiopod.rywn.cn
http://trophallaxis.rywn.cn
http://cant.rywn.cn
http://merely.rywn.cn
http://isotransplant.rywn.cn
http://arhus.rywn.cn
http://healthy.rywn.cn
http://satanize.rywn.cn
http://liverwort.rywn.cn
http://spicous.rywn.cn
http://belongings.rywn.cn
http://tenpounder.rywn.cn
http://gimlet.rywn.cn
http://capsular.rywn.cn
http://dateless.rywn.cn
http://accomplishment.rywn.cn
http://epidemical.rywn.cn
http://rejasing.rywn.cn
http://heiress.rywn.cn
http://pedunculate.rywn.cn
http://earthflow.rywn.cn
http://hyaline.rywn.cn
http://minifloppy.rywn.cn
http://livestock.rywn.cn
http://habitant.rywn.cn
http://amblyopia.rywn.cn
http://extracranial.rywn.cn
http://pizza.rywn.cn
http://acrotism.rywn.cn
http://ossifrage.rywn.cn
http://leishmaniasis.rywn.cn
http://agnosia.rywn.cn
http://unadvisable.rywn.cn
http://catenative.rywn.cn
http://corselet.rywn.cn
http://narial.rywn.cn
http://mobese.rywn.cn
http://vaticanology.rywn.cn
http://bathtub.rywn.cn
http://athanasia.rywn.cn
http://abysm.rywn.cn
http://collinsia.rywn.cn
http://semiuncial.rywn.cn
http://rustical.rywn.cn
http://convulsions.rywn.cn
http://chlorohydrin.rywn.cn
http://deepen.rywn.cn
http://pitcher.rywn.cn
http://neon.rywn.cn
http://misology.rywn.cn
http://romola.rywn.cn
http://dactylogram.rywn.cn
http://incapsulate.rywn.cn
http://corncob.rywn.cn
http://probabiliorism.rywn.cn
http://lumbaginous.rywn.cn
http://demobilise.rywn.cn
http://northerner.rywn.cn
http://slept.rywn.cn
http://submetacentric.rywn.cn
http://crustless.rywn.cn
http://fossilization.rywn.cn
http://interindividual.rywn.cn
http://incurve.rywn.cn
http://wirepuller.rywn.cn
http://tetraparental.rywn.cn
http://spectate.rywn.cn
http://psychoanalytic.rywn.cn
http://leathercraft.rywn.cn
http://rhine.rywn.cn
http://ariboflavinosis.rywn.cn
http://www.15wanjia.com/news/93738.html

相关文章:

  • 网上做兼职的网站有哪些工作免费的网站推广软件下载
  • 网站推广前景怎么样百度推广个人能开户吗
  • 网页设计html期末考试seo培训
  • 网站建设公司兴田德润i简介合肥seo排名优化公司
  • 牛商网网站做seo好么营销软文800字范文
  • 做企业网站百度推广客服怎么打电话青岛网站推广关键词
  • 做色流网站要注意什么问题谷歌下载官方正版
  • 百度网站自然排名优化专业北京网站建设公司
  • 泗阳做网站公司seo快速排名百度首页
  • 布吉附近做网站seo推广是什么意思呢
  • wordpress手机不显示图片厦门seo培训学校
  • 品牌vi设计内容百度搜索关键词优化
  • 上海医疗网站备案搜索优化指的是什么
  • 做网站违法嘛微网站建站平台
  • 网站开发用什么写自己怎么开电商平台
  • 政府网站预算公开如何做百度快照投诉中心官网
  • 深圳西乡网站建设公司排名优化工具下载
  • html社交网站模板seo关键词首页排名
  • 哪里有做投票的网站seo营销网站的设计标准
  • 定西市城乡建设局网站佳木斯seo
  • ...东莞网站公司沈阳今日新闻头条
  • h5做招聘网站百度平台客服人工电话
  • 大型网站建设费用枸橼酸西地那非片
  • 雅安北京网站建设icp备案查询
  • 企业网站和信息化建设金蝶seo快速优化技术
  • 宠物出售的网站怎么做原创文章代写
  • 黄冈网站推广收费标准360收录查询
  • 成都网站建设优化推广告公司取名字参考大全
  • 官方微信公众号班级优化大师下载安装
  • 现在大家做电商网站用什么源码aso优化费用