riku
2025-04-27 233a467167e2b363098cc7fa63e7f26d1d15507b
miniprogram_npm/tdesign-miniprogram/radio/radio.js
@@ -35,13 +35,7 @@
        };
        this.lifetimes = {
            attached() {
                this.initStatus();
            },
            ready() {
                var _a, _b, _c, _d;
                this.setData({
                    _placement: (_d = (_a = this.data.placement) !== null && _a !== void 0 ? _a : (_c = (_b = this.$parent) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.placement) !== null && _d !== void 0 ? _d : 'left',
                });
                this.init();
            },
        };
        this.properties = Object.assign(Object.assign({}, Props), { borderless: {
@@ -62,38 +56,44 @@
            optionLinked: false,
            iconVal: [],
            _placement: '',
            _disabled: false,
        };
        this.observers = {
            disabled(v) {
                this.setData({ _disabled: v });
            },
        };
        this.methods = {
            handleTap(e) {
                if (this.data.disabled)
                    return;
                const { _disabled, readonly, contentDisabled } = this.data;
                const { target } = e.currentTarget.dataset;
                if (target === 'text' && this.data.contentDisabled)
                if (_disabled || readonly || (target === 'text' && contentDisabled))
                    return;
                this.doChange();
            },
            doChange() {
                const { value, checked } = this.data;
                const { value, checked, allowUncheck } = this.data;
                if (this.$parent) {
                    this.$parent.updateValue(value);
                    this.$parent.updateValue(checked && allowUncheck ? null : value);
                }
                else {
                    this._trigger('change', { checked: !checked });
                    this._trigger('change', { checked: checked && allowUncheck ? false : !checked });
                }
            },
            initStatus() {
                var _a, _b;
            init() {
                var _a, _b, _c, _d, _e, _f;
                const { icon } = this.data;
                const isIdArr = Array.isArray(((_a = this.$parent) === null || _a === void 0 ? void 0 : _a.icon) || icon);
                this.setData({
                    customIcon: isIdArr,
                    slotIcon: icon === 'slot',
                    iconVal: isIdArr ? ((_b = this.$parent) === null || _b === void 0 ? void 0 : _b.icon) || icon : [],
                    _placement: (_f = (_c = this.data.placement) !== null && _c !== void 0 ? _c : (_e = (_d = this.$parent) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.placement) !== null && _f !== void 0 ? _f : 'left',
                });
            },
            setDisabled(disabled) {
                this.setData({
                    disabled: this.data.disabled || disabled,
                    _disabled: this.data.disabled || disabled,
                });
            },
        };