first commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
.uni-popup-dialog {
|
||||
width: 300px;
|
||||
border-radius: 11px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.uni-dialog-title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
padding-top: 25px;
|
||||
}
|
||||
.uni-dialog-title-text {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.uni-dialog-content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.uni-dialog-content-text {
|
||||
font-size: 14px;
|
||||
color: #6C6C6C;
|
||||
}
|
||||
.uni-dialog-button-group {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border-top-color: #f5f5f5;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
.uni-dialog-button {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
}
|
||||
.uni-border-left {
|
||||
border-left-color: #f0f0f0;
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.uni-dialog-button-text {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
.uni-button-color {
|
||||
color: #007aff;
|
||||
}
|
||||
.uni-dialog-input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
border: 1px #eee solid;
|
||||
height: 40px;
|
||||
padding: 0 10px;
|
||||
border-radius: 5px;
|
||||
color: #555;
|
||||
}
|
||||
.uni-popup__success {
|
||||
color: #4cd964;
|
||||
}
|
||||
.uni-popup__warn {
|
||||
color: #f0ad4e;
|
||||
}
|
||||
.uni-popup__error {
|
||||
color: #dd524d;
|
||||
}
|
||||
.uni-popup__info {
|
||||
color: #909399;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-popup-dialog"><view class="uni-dialog-title"><text class="{{('uni-dialog-title-text') + ' ' + b}}">{{a}}</text></view><view a:if="{{c}}" class="uni-dialog-content"><slot><text class="uni-dialog-content-text">{{d}}</text></slot></view><view a:else class="uni-dialog-content"><slot><input class="uni-dialog-input" maxlength="{{e}}" type="{{f}}" placeholder="{{g}}" focus="{{h}}" value="{{i}}" onInput="{{j}}"></input></slot></view><view class="uni-dialog-button-group"><view a:if="{{k}}" class="uni-dialog-button" onTap="{{m}}"><text class="uni-dialog-button-text">{{l}}</text></view><view class="{{('uni-dialog-button') + ' ' + o}}" onTap="{{p}}"><text class="uni-dialog-button-text uni-button-color">{{n}}</text></view></view></view>
|
||||
170
unpackage/dist/dev/mp-alipay/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.js
vendored
Normal file
170
unpackage/dist/dev/mp-alipay/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.js
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
const uni_modules_uniPopup_components_uniPopup_popup = require("../uni-popup/popup.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniPopup_components_uniPopup_i18n_index = require("../uni-popup/i18n/index.js");
|
||||
const {
|
||||
t
|
||||
} = common_vendor.initVueI18n(uni_modules_uniPopup_components_uniPopup_i18n_index.messages);
|
||||
const _sfc_main = {
|
||||
name: "uniPopupDialog",
|
||||
mixins: [uni_modules_uniPopup_components_uniPopup_popup.popup],
|
||||
emits: ["confirm", "close", "update:modelValue", "input"],
|
||||
props: {
|
||||
inputType: {
|
||||
type: String,
|
||||
default: "text"
|
||||
},
|
||||
showClose: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
},
|
||||
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
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogType: "error",
|
||||
val: ""
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
okText() {
|
||||
return this.confirmText || t("uni-popup.ok");
|
||||
},
|
||||
closeText() {
|
||||
return this.cancelText || t("uni-popup.cancel");
|
||||
},
|
||||
placeholderText() {
|
||||
return this.placeholder || t("uni-popup.placeholder");
|
||||
},
|
||||
titleText() {
|
||||
return this.title || t("uni-popup.title");
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
type(val) {
|
||||
this.dialogType = val;
|
||||
},
|
||||
mode(val) {
|
||||
if (val === "input") {
|
||||
this.dialogType = "info";
|
||||
}
|
||||
},
|
||||
value(val) {
|
||||
if (this.maxlength != -1 && this.mode === "input") {
|
||||
this.val = val.slice(0, this.maxlength);
|
||||
} else {
|
||||
this.val = val;
|
||||
}
|
||||
},
|
||||
val(val) {
|
||||
this.$emit("update:modelValue", val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.popup.disableMask();
|
||||
if (this.mode === "input") {
|
||||
this.dialogType = "info";
|
||||
this.val = this.value;
|
||||
this.val = this.modelValue;
|
||||
} else {
|
||||
this.dialogType = this.type;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击确认按钮
|
||||
*/
|
||||
onOk() {
|
||||
if (this.mode === "input") {
|
||||
this.$emit("confirm", this.val);
|
||||
} else {
|
||||
this.$emit("confirm");
|
||||
}
|
||||
if (this.beforeClose)
|
||||
return;
|
||||
this.popup.close();
|
||||
},
|
||||
/**
|
||||
* 点击取消按钮
|
||||
*/
|
||||
closeDialog() {
|
||||
this.$emit("close");
|
||||
if (this.beforeClose)
|
||||
return;
|
||||
this.popup.close();
|
||||
},
|
||||
close() {
|
||||
this.popup.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t($options.titleText),
|
||||
b: common_vendor.n("uni-popup__" + $data.dialogType),
|
||||
c: $props.mode === "base"
|
||||
}, $props.mode === "base" ? {
|
||||
d: common_vendor.t($props.content)
|
||||
} : {
|
||||
e: $props.maxlength,
|
||||
f: $props.inputType,
|
||||
g: $options.placeholderText,
|
||||
h: $props.focus,
|
||||
i: $data.val,
|
||||
j: common_vendor.o(($event) => $data.val = $event.detail.value)
|
||||
}, {
|
||||
k: $props.showClose
|
||||
}, $props.showClose ? {
|
||||
l: common_vendor.t($options.closeText),
|
||||
m: common_vendor.o((...args) => $options.closeDialog && $options.closeDialog(...args))
|
||||
} : {}, {
|
||||
n: common_vendor.t($options.okText),
|
||||
o: common_vendor.n($props.showClose ? "uni-border-left" : ""),
|
||||
p: common_vendor.o((...args) => $options.onOk && $options.onOk(...args))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
my.createComponent(Component);
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {}
|
||||
}
|
||||
Reference in New Issue
Block a user