123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- "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"],
- props: {
- inputType: {
- type: String,
- default: "text"
- },
- value: {
- type: [String, Number],
- 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: ""
- }
- },
- data() {
- return {
- dialogType: "error",
- focus: false,
- 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) {
- this.val = val;
- }
- },
- created() {
- this.popup.disableMask();
- if (this.mode === "input") {
- this.dialogType = "info";
- this.val = this.value;
- } else {
- this.dialogType = this.type;
- }
- },
- mounted() {
- this.focus = true;
- },
- 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.inputType,
- f: $options.placeholderText,
- g: $data.focus,
- h: $data.val,
- i: common_vendor.o(($event) => $data.val = $event.detail.value)
- }, {
- j: common_vendor.t($options.closeText),
- k: common_vendor.o((...args) => $options.closeDialog && $options.closeDialog(...args)),
- l: common_vendor.t($options.okText),
- m: common_vendor.o((...args) => $options.onOk && $options.onOk(...args))
- });
- }
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/development/HbuildWorkspace/KPS/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"]]);
- wx.createComponent(Component);
|