wong1988 1 year ago
parent
commit
5b95cf0296
  1. 38
      uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

38
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

@ -5,12 +5,14 @@
</view>
<view v-if="mode === 'base'" class="uni-dialog-content">
<slot>
<text class="uni-dialog-content-text">{{content}}</text>
<textarea class="uni-dialog-content-text" :value="content" :auto-height="false"
style="max-height: 200px;"></textarea>
</slot>
</view>
<view v-else class="uni-dialog-content">
<slot>
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" >
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText"
:focus="focus">
</slot>
</view>
<view class="uni-dialog-button-group" v-if="!showConfirm">
@ -21,7 +23,7 @@
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
</view>
</view>
<!-- 倒计时按钮 -->
<view class="uni-dialog-button-group" v-if="showConfirm">
<view class="uni-dialog-button uni-border-left" @click="onOk">
@ -35,10 +37,12 @@
<script>
import popup from '../uni-popup/popup.js'
import {
initVueI18n
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages)
const {
t
} = initVueI18n(messages)
/**
* PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式
@ -62,9 +66,9 @@
export default {
name: "uniPopupDialog",
mixins: [popup],
emits:['confirm','close'],
emits: ['confirm', 'close'],
props: {
inputType:{
inputType: {
type: String,
default: 'text'
},
@ -96,11 +100,11 @@
type: Boolean,
default: false
},
cancelText:{
cancelText: {
type: String,
default: ''
},
confirmText:{
confirmText: {
type: String,
default: ''
},
@ -118,7 +122,7 @@
},
computed: {
okText() {
console.log('confirmText',this.confirmText);
console.log('confirmText', this.confirmText);
return this.confirmText || t("uni-popup.ok")
},
closeText() {
@ -163,12 +167,12 @@
* 点击确认按钮
*/
onOk() {
if (this.mode === 'input'){
if (this.mode === 'input') {
this.$emit('confirm', this.val)
}else{
} else {
this.$emit('confirm')
}
if(this.beforeClose) return
if (this.beforeClose) return
this.popup.close()
},
/**
@ -176,17 +180,17 @@
*/
closeDialog() {
this.$emit('close')
if(this.beforeClose) return
if (this.beforeClose) return
this.popup.close()
},
close(){
close() {
this.popup.close()
}
}
}
</script>
<style lang="scss" >
<style lang="scss">
.uni-popup-dialog {
width: 300px;
border-radius: 11px;
@ -284,4 +288,4 @@
.uni-popup__info {
color: #909399;
}
</style>
</style>
Loading…
Cancel
Save