| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <div class="doc">
- <view class="box">
- <u-badge :value="value.length">
- </u-badge>
- </view>
- <u-button :plain="true" :hairline="true" v-if="type != 'view'" size='mini' text="上传"
- @click="handleUpload"></u-button>
- <u-button :plain="true" :hairline="true" v-else size='mini' text="查看" @click="handleUpload"></u-button>
- </div>
- </template>
- <script>
- export default {
- name: 'index',
- model: {
- prop: 'value',
- event: 'updateVal'
- },
- props: {
- type: {
- type: String,
- default: ''
- },
- value: {
- type: Array,
- default: () => {
- return [];
- }
- }
- },
- data() {
- return {
- selectVal: ''
- };
- },
- watch: {
- value: {
- handler(newVal) {
- this.selectVal = newVal || [];
- },
- immediate: true
- }
- },
- created() {
- uni.$off('getFiles')
- uni.$on('getFiles', (id) => {
- this.getFiles(id)
- })
- },
- destroyed() {
- uni.$off('getFiles')
- },
- methods: {
- handleUpload() {
- console.log('1111111')
- uni.navigateTo({
- url: '/pages/doc/docList?fileId=' + JSON.stringify(this.selectVal)
- })
- },
- getFiles(val = []) {
- this.$emit('updateVal', val);
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .doc {
- position: relative;
- .box {
- position: absolute;
- right: -20rpx;
- top: -15rpx;
- width: 40rpx;
- z-index: 999;
- }
- uni-button {
- width: 100rpx;
- // height: 50rpx;
- margin-left: 10rpx;
- margin-right: 0;
- color: #fff !important;
- border: none;
- background: #157a2c !important;
- }
- }
- </style>
|