123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <view class="uni-popup-dialog">
- <view class="uni-popup-list">
- <view class="uni-popup-item">
- <view class="iconfont-im icon-shanchu uni-popup-item-info" @tap="confirm(1)"><text class="info">删除</text></view>
- <view class="iconfont-im icon-zhuanfa uni-popup-item-info" @tap="confirm(2)"><text class="info">转发</text></view>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- name: "uniPopupImg",
- props: {
- value: {
- type: [String, Number],
- default: ''
- },
- maxlength:{
- type: Number,
- default: 10
- },
- placeholder: {
- type: [String, Number],
- default: '请输入内容'
- },
-
- type: {
- type: String,
- default: 'error'
- },
-
- mode: {
- type: String,
- default: 'base'
- },
-
- title: {
- type: String,
- default: '提示'
- },
-
- content: {
- type: String,
- default: ''
- },
-
- beforeClose: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- dialogType: 'error',
- focus: false,
- val: ""
- }
- },
- inject: ['popup'],
- watch: {
- type(val) {
- this.dialogType = val
- },
- mode(val) {
- if (val === 'input') {
- this.dialogType = 'info'
- }
- },
- value(val) {
- this.val = val
- }
- },
- created() {
-
- this.popup.mkclick = false
- if (this.mode === 'input') {
- this.dialogType = 'info'
- this.val = this.value
- } else {
- this.dialogType = this.type
- }
- },
- mounted() {
- this.focus = true
- },
- methods: {
-
- onOk() {
- this.$emit('confirm', () => {
- this.popup.close()
- if (this.mode === 'input') {
- this.val = this.value;
- return this.val;
- }
- }, this.mode === 'input' ? this.val : '')
- },
- confirm(val){
- this.$emit('confirm',{type:val})
- },
-
- close() {
- if (this.beforeClose) {
- this.$emit('close', () => {
- this.popup.close()
- })
- return
- }
- this.popup.close()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .uni-popup-dialog {
- width: 550rpx;
- border-radius: 15px;
- background-color: #d8d8d8;
- padding-left: 25px;
- padding-top: 30px;
- padding-bottom: 30px;
- }
- .info{
- font-size: 16px;
- margin-left: 30rpx;
- }
- .uni-popup-item{
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .uni-popup-item-info{
- display: flex;
- align-items: center;
- }
- </style>
|