uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
19
uni_modules/uview-plus/components/u-pdf-reader/props.js
Normal file
19
uni_modules/uview-plus/components/u-pdf-reader/props.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export default {
|
||||
props: {
|
||||
// PDF文件地址
|
||||
src: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 组件高度
|
||||
height: {
|
||||
type: String,
|
||||
default: '500px'
|
||||
},
|
||||
// pdfjs资源域名
|
||||
baseUrl: {
|
||||
type: String,
|
||||
default: 'https://uview-plus.jiangruyi.com/h5'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<view class="up-pdf-reader" :style="{ height: height }">
|
||||
<web-view :fullscreen="false"
|
||||
:src="viewerUrl" :style="{ width: '750rpx', height: height }"
|
||||
:webview-styles="{ width: '750rpx', height: height }"
|
||||
frameborder="0"
|
||||
></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import props from './props.js';
|
||||
|
||||
/**
|
||||
* pdfReader PDF阅读器
|
||||
* @description 基于pdf.js的PDF阅读器组件
|
||||
* @tutorial https://uview-plus.jiangruyi.com/components/pdfReader.html
|
||||
* @property {String} src PDF文件地址
|
||||
* @property {String} height 组件高度,默认为'700px'
|
||||
* @property {String} pdfjsDomain pdfjs资源域名,默认为'https://uview-plus.jiangruyi.com/h5'
|
||||
* @example <up-pdf-reader src="https://example.com/file.pdf"></up-pdf-reader>
|
||||
*/
|
||||
export default {
|
||||
name: 'up-pdf-reader',
|
||||
mixins: [props],
|
||||
data() {
|
||||
return {
|
||||
baseUrlInner: 'https://uview-plus.jiangruyi.com/h5',
|
||||
viewerUrl: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
baseUrl: function (val) {
|
||||
this.baseUrl = val;
|
||||
},
|
||||
src: function (val) {
|
||||
this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.baseUrl) {
|
||||
this.baseUrlInner = this.baseUrl;
|
||||
}
|
||||
this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(this.src);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.up-pdf-reader {
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user