|
@@ -0,0 +1,91 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="doc-comp">
|
|
|
|
+ <web class="web-comp" src="{{websrc}}" allowthirdpartycookies="{{allow}}" onpagestart="onPageStart" onpagefinish="onPageFinish" ontitlereceive="onTitleReceive" onerror="onError" onprogress="onProgress" id="web"></web>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import router from '@system.router'
|
|
|
|
+ import prompt from '@system.prompt'
|
|
|
|
+ export default {
|
|
|
|
+ data: {
|
|
|
|
+ websrc: '',
|
|
|
|
+ titleBarParams: {
|
|
|
|
+ type: 'titleBar',
|
|
|
|
+ config: {
|
|
|
|
+ 'titleBarShow': true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ allow: false
|
|
|
|
+ },
|
|
|
|
+ onInit () {
|
|
|
|
+ this.websrc = this.url
|
|
|
|
+ this.allow = this.allowthirdpartycookies === 'true'
|
|
|
|
+ this.$page.setTitleBar({ text: this.title })
|
|
|
|
+ this.$on('arrowLeft', this.arrowLeftIcon)
|
|
|
|
+ this.$on('arrowRight', this.arrowRightIcon)
|
|
|
|
+ },
|
|
|
|
+ onPageStart (evt) {
|
|
|
|
+ this.isSupportWebRTC()
|
|
|
|
+ console.info(`### pagestart ### url: ${evt.url} canBack: ${ evt.canBack } canForward: ${ evt.canForward }`)
|
|
|
|
+ },
|
|
|
|
+ onPageFinish (evt) {
|
|
|
|
+ console.info(`### pagestart ### url: ${evt.url} canBack: ${ evt.canBack } canForward: ${ evt.canForward }`)
|
|
|
|
+ },
|
|
|
|
+ onTitleReceive (evt) {
|
|
|
|
+ this.titleBarParams.config.title = evt.title
|
|
|
|
+ },
|
|
|
|
+ onError (evt) {
|
|
|
|
+ console.info(`### pageError ###`, evt)
|
|
|
|
+ },
|
|
|
|
+ onProgress (evt) {
|
|
|
|
+ console.info('progressValue: ' + evt.progress)
|
|
|
|
+ },
|
|
|
|
+ arrowLeftIcon () {
|
|
|
|
+ this.isCanBack()
|
|
|
|
+ },
|
|
|
|
+ arrowRightIcon () {
|
|
|
|
+ this.isCanForward()
|
|
|
|
+ },
|
|
|
|
+ isCanForward () {
|
|
|
|
+ this.$element('web').canForward({
|
|
|
|
+ callback: function(e){
|
|
|
|
+ if(e){
|
|
|
|
+ this.$element('web').forward()
|
|
|
|
+ }
|
|
|
|
+ }.bind(this)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ isCanBack () {
|
|
|
|
+ this.$element('web').canBack({
|
|
|
|
+ callback: function(e){
|
|
|
|
+ if (e) {
|
|
|
|
+ this.$element('web').back()
|
|
|
|
+ } else {
|
|
|
|
+ router.back()
|
|
|
|
+ }
|
|
|
|
+ }.bind(this)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ isSupportWebRTC () {
|
|
|
|
+ this.$element('web').isSupportWebRTC({
|
|
|
|
+ callback: function (data){
|
|
|
|
+ console.log(`是否支持webrtc功能:${ data }`)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang ="less">
|
|
|
|
+ .doc-comp {
|
|
|
|
+ flex: 1;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ padding: 0 10px;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ .web-comp {
|
|
|
|
+ flex: 1;
|
|
|
|
+ height: calc(100);
|
|
|
|
+ }
|
|
|
|
+</style>
|