| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { uploaderMixin, supportMixin } from './common/mixins' |
| | | import { uploaderMixin, supportMixin } from "./common/mixins"; |
| | | |
| | | const COMPONENT_NAME = 'uploader-btn' |
| | | const COMPONENT_NAME = "uploader-btn"; |
| | | |
| | | export default { |
| | | name: COMPONENT_NAME, |
| | |
| | | props: { |
| | | directory: { |
| | | type: Boolean, |
| | | default: false |
| | | default: false, |
| | | }, |
| | | single: { |
| | | type: Boolean, |
| | | default: false |
| | | default: false, |
| | | }, |
| | | attrs: { |
| | | type: Object, |
| | | default() { |
| | | return {} |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | watch: { |
| | | attrs: { |
| | | handler(n, o) { |
| | | //this.$nextTick(() => { |
| | | this.uploader.uploader.assignBrowse(this.$refs.btn, this.directory, this.single, n) |
| | | //}) |
| | | return {}; |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | sourceType: { |
| | | type: Number, |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | console.log('attrs', this.attrs) |
| | | this.uploader.uploader.assignBrowse(this.$refs.btn, this.directory, this.single, this.attrs) |
| | | }) |
| | | } |
| | | } |
| | | let props = { accept: "" }; |
| | | if (this.sourceType == 1) { |
| | | props.accept = ".mp4"; |
| | | } else if (this.sourceType == 2) { |
| | | props.accept = ".jpg,.jpeg,.png"; |
| | | } |
| | | this.uploader.uploader.assignBrowse( |
| | | this.$refs.btn, |
| | | this.directory, |
| | | this.single, |
| | | props |
| | | ); |
| | | }); |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | outline: none; |
| | | } |
| | | .uploader-btn:hover { |
| | | background-color: rgba(0, 0, 0, 0.08); |
| | | /* background-color: rgba(0, 0, 0, 0.08); */ |
| | | } |
| | | </style> |