var app = new Vue({
    el: '#app',
    data() {

        return {
            textareaold: '',
            textareanew: '',
        };
    },
    methods: {
        convertText() {
            console.log(this.textareaold);
            this.textareanew = this.littleEndianToBigEndianDecimal(this.textareaold);
        },
        logHome() {
            window.location.href = "/Home/Index";
        },
        littleEndianToBigEndianDecimal(hexStr) {
            const hexArray = hexStr.split(' ');
            const result = [];
            for (let i = 0; i < hexArray.length; i += 2) {
                // 确保有足够的元素组成一对
                if (i + 1 >= hexArray.length) break;
                const byte1 = hexArray[i];
                const byte2 = hexArray[i + 1];
                // 交换字节顺序并合并
                const bigEndianHex = byte2 + byte1;
                // 转换为十进制
                const decimal = parseInt(bigEndianHex, 16);
                result.push(decimal.toString());
            }
            return result.join(' ');
        }
    },
    created: function () { // 页面创建时执行

    },
    mounted: function () {


    },
    beforeDestroy: function () {

    },
});