let 76. Minimum Window Substring

 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).

For example,
S = "ADOBECODEBANC"
T = "ABC"

Minimum window is "BANC".

Note:
If there is no such window in S that covers all characters in T, return the empty string "".

If there are multiple such windows, you are guaranteed that there will always be only one unique minimum window in S. 

主题思想: 总体思路如下: 利用hashMap , 2. 利用两个指针,进行夹逼, 找到最小的窗口。

具体细节:1. 对 t 中的字符进行hash统计出现的次数。 对于未在t中出现的,初始化为0. 这个意思是把所有的字符都统计起来。 初始化一个数字num 为t的长度
2. 遍历 s 中 字符,判断是否大于0,如果大于0 ,则在t中出现过,num–; 表示还有num-1个没有包含。最后无论是否在t中出现,都要对map进行更新 -1。
3. 如果num==0表示已经全部包含t中所有字符,但是可能有多余的无关字符,或者冗余字符,这时移动左边指针,缩小窗口,如果字符的value值是0,则表示找到一个t中字符,num++; 更新使num增加,变成非法。 并所有value+1

具体AC代码:

总结起来 end下标右移扩大窗口,所有value值 每次减

class Solution {
    public String minWindow(String s, String t) {

        HashMap<Character,Integer> wordCounter=new HashMap<Character,Integer>();

        int len=t.length();
        for(int i=0;i<len;i++) wordCounter.put(t.charAt(i),wordCounter.getOrDefault(t.charAt(i),0)+1);

        int begin=0,end=0;
        int num=len;

        int mini=Integer.MAX_VALUE;
        String ans="";
        while(end<s.length()){

            if(wordCounter.getOrDefault(s.charAt(end),-2)>0){
                num--; // find the character in t  
            }
            //here make all character not in t put with default -1
            wordCounter.put(s.charAt(end),wordCounter.getOrDefault(s.charAt(end),0)-1);
            while(num==0){

                //update ans
                if(end-begin+1<mini){
                    mini=end-begin+1;
                    ans=s.substring(begin,end+1);
                }

                //because begin<end so  s.charAt(begin) must in wordCounter so can use get not need getOrDefault
                if(wordCounter.get(s.charAt(begin))==0){  // make invalid  ,so find the miniums
                    num++;
                }
                wordCounter.put(s.charAt(begin),wordCounter.get(s.charAt(begin))+1);
                begin++;
            }
            end++;
        }
        return ans;
    }
}
<template> <div class="web-view-container"> <view class="nav-bar"> <up-navbar title="在线咨询" bgColor="#165DFF"></up-navbar> </view> <web-view :src="webViewUrl" id="consultingWebView"></web-view> </div> </template> <script setup> import { ref } from "vue"; import { onLoad } from "@dcloudio/uni-app"; const webViewUrl = ref(""); onLoad(() => { webViewUrl.value = uni.getStorageSync("consultingUrl") || ""; uni.removeStorageSync("consultingUrl"); // 延迟注入UEM配置和视口修正代码 setTimeout(() => { // // 使用uni.getSystemInfoSync()替代uni.env.platform获取平台信息 // const isH5 = uni.getSystemInfoSync().platform === "h5"; const injectScript = ` // 配置UEM的S码(请替换为实际S码) // 配置UEM的S码(已设置为实际值S02086) // UEM完整配置(按文档要求格式) window.uemConfig = { sCode: 'S02086', version: '1.0.0', timestamp: new Date().getTime(), environment: process.env.NODE_ENV || 'production' }; console.log('[UEM配置] 完整配置:', window.uemConfig); // 多重验证机制 const configValid = window.uemConfig && window.uemConfig.sCode === 'S02086'; if (!configValid) { console.error('[UEM配置] 严重错误:S码配置验证失败', window.uemConfig); // 尝试从localStorage恢复 const stored = localStorage.getItem('uemConfig'); if (stored) { window.uemConfig = JSON.parse(stored); console.log('[UEM配置] 已从localStorage恢复:', window.uemConfig); } } else { console.log('[UEM配置] S码验证成功'); localStorage.setItem('uemConfig', JSON.stringify(window.uemConfig)); sessionStorage.setItem('uemConfig', JSON.stringify(window.uemConfig)); } // 修正视口设置 const meta = document.querySelector('meta[name=viewport]') || document.createElement('meta'); meta.name = 'viewport'; meta.content = 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'; if (!document.querySelector('meta[name=viewport]')) { document.head.appendChild(meta); } `; // 统一平台判断逻辑 const systemInfo = uni.getSystemInfoSync(); const isH5 = typeof window !== 'undefined' && systemInfo.platform === 'h5'; if (isH5) { // H5环境下使用iframe注入脚本 // 增加延迟确保web-view完全加载 // 增强的web-view加载检测与注入机制 let webView = null; let injectionAttempts = 0; const maxAttempts = 8; const initialDelay = 500; const backoffFactor = 1.5; const fullConfig = { sCode: 'S02086', version: '1.0.0', timestamp: new Date().getTime(), environment: typeof window !== 'undefined' ? 'h5' : 'other' }; // 配置日志工具 const logWithTime = (message) => { const time = new Date().toISOString().split('T')[1].slice(0, 11); console.log(`[${time}][UEM注入]`, message); }; // 核心注入函数 const injectConfig = (targetWindow) => { try { // 清除旧配置 targetWindow.uemConfig = null; // 设置新配置 targetWindow.uemConfig = { ...fullConfig, attempt: injectionAttempts }; logWithTime(`配置已设置: ${JSON.stringify(targetWindow.uemConfig)}`); // 验证配置 if (targetWindow.uemConfig?.sCode !== 'S02086') { throw new Error(`配置验证失败: ${targetWindow.uemConfig?.sCode || '未设置'}`); } // 初始化UEM if (targetWindow.uem && typeof targetWindow.uem.init === 'function') { logWithTime('调用UEM.init()'); const startTime = performance.now(); const result = targetWindow.uem.init(); const duration = performance.now() - startTime; logWithTime(`UEM初始化完成 (${duration.toFixed(2)}ms): ${JSON.stringify(result)}`); return true; } else { logWithTime('UEM对象不存在,创建增强模拟对象'); targetWindow.uem = targetWindow.uem || {}; targetWindow.uem.init = function() { logWithTime('[模拟UEM] 初始化完成'); return { success: true, sCode: fullConfig.sCode, timestamp: Date.now() }; }; targetWindow.uem.getConfig = function() { return targetWindow.uemConfig; }; const result = targetWindow.uem.init(); logWithTime(`模拟UEM初始化结果: ${JSON.stringify(result)}`); return true; } } catch (e) { logWithTime(`注入失败: ${e.message}`); return false; } }; // 多路径注入策略 const attemptInjection = () => { injectionAttempts++; const currentDelay = initialDelay * Math.pow(backoffFactor, injectionAttempts - 1); logWithTime(`第${injectionAttempts}次尝试 (延迟${currentDelay.toFixed(0)}ms)`); // 尝试获取web-view元素 webView = document.querySelector('#consultingWebView'); let injectionSuccess = false; // 路径1: 通过web-view的contentWindow注入 (带postMessage备选) if (webView) { logWithTime(`web-view状态: ${webView.tagName}#${webView.id}, src=${webView.src.substring(0, 50)}`); try { // 检查contentWindow是否可访问 if (webView.contentWindow) { logWithTime('尝试通过contentWindow注入'); injectionSuccess = injectConfig(webView.contentWindow); if (!injectionSuccess) { // 尝试使用postMessage logWithTime('contentWindow注入失败,尝试postMessage'); webView.contentWindow.postMessage({ type: 'UEM_CONFIG_INJECTION', config: fullConfig }, '*'); injectionSuccess = true; // 标记为成功发送,但实际成功需要确认 } } else { logWithTime('web-view.contentWindow不可用'); } } catch (e) { logWithTime(`web-view注入异常: ${e.message}`); } } else { logWithTime('未找到web-view元素'); } // 路径2: 如果web-view注入失败,尝试直接在当前窗口注入 if (!injectionSuccess && typeof window !== 'undefined') { logWithTime('尝试直接在当前窗口注入'); injectionSuccess = injectConfig(window); } // 路径3: 创建iframe动态注入 if (!injectionSuccess) { logWithTime('尝试通过临时iframe注入'); const tempIframe = document.createElement('iframe'); tempIframe.style.display = 'none'; document.body.appendChild(tempIframe); try { if (tempIframe.contentWindow) { injectionSuccess = injectConfig(tempIframe.contentWindow); if (injectionSuccess) { logWithTime('iframe注入成功,复制配置回主窗口'); window.uemConfig = tempIframe.contentWindow.uemConfig; window.uem = tempIframe.contentWindow.uem; } } } catch (e) { logWithTime(`iframe注入异常: ${e.message}`); } finally { document.body.removeChild(tempIframe); } } // 结果处理与重试逻辑 if (injectionSuccess) { logWithTime('配置注入成功!'); localStorage.setItem('uemConfig', JSON.stringify(fullConfig)); sessionStorage.setItem('uemConfig', JSON.stringify(fullConfig)); // 发送成功事件 window.dispatchEvent(new CustomEvent('uemInjectionSuccess', { detail: fullConfig })); return true; } else if (injectionAttempts < maxAttempts) { logWithTime(`注入失败,${currentDelay.toFixed(0)}ms后重试`); setTimeout(attemptInjection, currentDelay); } else { logWithTime('所有注入尝试均已失败'); // 最后的应急措施 window.uemConfig = fullConfig; window.uem = { init: () => { const result = { success: true, sCode: fullConfig.sCode, emergency: true }; logWithTime(`[应急模式] UEM初始化: ${JSON.stringify(result)}`); return result; }, getConfig: () => window.uemConfig }; // 显示用户通知 uni.showModal({ title: '初始化提示', content: '聊天功能已启用基础模式,部分功能可能受限。如遇问题,请刷新页面重试。', showCancel: false }); return false; } }; // 设置web-view加载完成监听器 const setupWebViewListener = () => { const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (!webView) { webView = document.querySelector('#consultingWebView'); if (webView) { logWithTime('检测到web-view元素,开始注入流程'); observer.disconnect(); // 立即开始第一次尝试 attemptInjection(); } } }); }); // 观察body变化以检测web-view出现 observer.observe(document.body, { childList: true, subtree: true }); // 超时后备 - 如果10秒内未检测到web-view setTimeout(() => { if (!webView) { observer.disconnect(); logWithTime('web-view元素未检测到,启动后备注入流程'); attemptInjection(); } }, 10000); }; // 启动web-view检测 setupWebViewListener(); // 添加全局消息监听器处理web-view响应 window.addEventListener('message', (event) => { if (event.data.type === 'UEM_CONFIG_ACK') { logWithTime(`收到web-view确认: ${event.data.status}`); if (event.data.status === 'success') { localStorage.setItem('uemConfig', JSON.stringify(fullConfig)); sessionStorage.setItem('uemConfig', JSON.stringify(fullConfig)); } } }); } else if (typeof uni.createWebViewContext !== 'undefined') { // 非H5环境且API存在时使用 console.log('非H5环境注入脚本:', injectScript); uni.createWebViewContext('consultingWebView').evaluateJavaScript(injectScript); } else { // API不存在时显示错误并尝试备选方案 console.error('当前环境不支持uni.createWebViewContext,尝试直接执行脚本'); // 备选方案:直接在当前上下文执行脚本 try { // 强制重置并设置UEM配置 window.uemConfig = { sCode: 'S02086' }; console.log('[备选方案] 强制设置S码:', window.uemConfig.sCode); // 从localStorage读取配置确保一致性 const storedConfig = localStorage.getItem('uemConfig'); if (storedConfig) { window.uemConfig = JSON.parse(storedConfig); console.log('[备选方案] 从localStorage恢复配置:', window.uemConfig); } // 执行UEM初始化文档要求的代码 if (typeof window.uem === 'undefined') { console.log('[备选方案] UEM对象不存在,创建模拟对象'); window.uem = { init: function() { console.log('[备选方案] UEM初始化模拟成功'); // 模拟UEM初始化检查 if (window.uemConfig?.sCode === 'S02086') { console.log('[备选方案] UEM配置验证通过'); } else { console.error('[备选方案] UEM配置验证失败'); } } }; } if (window.uem && typeof window.uem.init === 'function') { console.log('[备选方案] 执行UEM初始化'); window.uem.init(); console.log('[备选方案] UEM初始化完成'); } else { console.error('[备选方案] UEM初始化函数不存在,执行终极备选方案'); // 终极备选:直接调用UEM可能使用的全局配置方法 if (window.configureUEM) { console.log('[备选方案] 调用window.configureUEM'); window.configureUEM({ sCode: 'S02086' }); } else { console.error('[备选方案] 所有配置方法均失败,尝试终极解决方案'); // 终极解决方案:动态创建UEM脚本 const uemScript = document.createElement('script'); uemScript.textContent = ` window.uemConfig = ${JSON.stringify(window.uemConfig)}; console.log('[动态脚本] UEM配置已设置:', window.uemConfig); if (!window.uem) window.uem = {}; window.uem.init = function() { console.log('[动态脚本] UEM初始化完成'); return { success: true, sCode: window.uemConfig.sCode }; }; window.uem.init(); `; document.head.appendChild(uemScript); console.log('[备选方案] 动态UEM脚本已注入'); } } } catch (e) { console.error('备选方案执行失败:', e); } } }, 2000); // 延长延迟确保页面加载完成 }); </script> <style lang="scss" scoped> :deep(.u-navbar__content__left) { display: none; } .web-view-container { position: fixed; top: 0; left: 0; width: 100%; height: 90%; z-index: 9999; } .nav-bar { height: 44px; display: flex; align-items: center; padding: 0 16px; background-color: #fff; border-bottom: 1px solid #eee; } .title { margin-left: 16px; font-size: 16px; font-weight: 500; } </style> const handleTabClick = (item) => { if (item.id === 2) { const url = "https://nesp.haier.net/webchatbot-new/#/h5chat?sysNum=1659675658214&sourceId=744&lang=zh_CN&userId=a94e6e99fd72b81eea697c5c90c99e2fc651a3670574652a8e20a9a0142ba9b0f1efb0f543c5603cf2d45532de3263759359e06f44d347942fbb95028d5ccd9f#reloaded"; uni.setStorageSync("consultingUrl", url); uni.navigateTo({ url: "/pages/consulting/index" }); return; } };这个页面中,需要嵌入一个外部的功能页,功能页中需要chat功能,嵌入后页面单点登录但是chat功能不能使用,并且报当前环境不支持uni.createWebViewContext,尝试直接执行脚本,应该怎么改
最新发布
08-16
<template> <view class="container"> <view class="header"> <text class="title">历史记录</text> </view> <view class="content"> <view v-if="history.length === 0" class="empty-history"> <text class="empty-text">暂无历史记录</text> </view> <view v-else> <view class="history-item" v-for="(item, index) in history" :key="index" @click="viewDetail(item)"> <view class="original"> <text class="original-text">{{item.original}}</text> </view> <view class="language-info"> <text class="language-pair">{{languagePair(item.from, item.to)}}</text> <text class="arrow">></text> </view> </view> </view> </view> <view class="footer"> <navigator url="/pages/translate/translate" class="translate-btn"> <text class="icon translate-icon"></text> <text class="text">翻译</text> </navigator> </view> </view> </template> <script> export default { data() { return { languageCodes: { 'zh-CHS': '简体中文', 'zh-CHT': '繁体中文', 'en': '英文', 'ja': '日文', 'ko': '韩文', 'fr': '法文', 'es': '西班牙文' }, history: [] }; }, onLoad() { this.loadHistory(); }, methods: { loadHistory() { const history = uni.getStorageSync('translationHistory') || []; this.history = history; }, languagePair(from, to) { return `${this.languageCodes[from]}->${this.languageCodes[to]}`; }, viewDetail(item) { uni.navigateTo({ url: `/pages/result/result?original=${encodeURIComponent(item.original)}&translation=${encodeURIComponent(item.translation)}&from=${item.from}&to=${item.to}` }); } } }; </script> <style scoped> .container { padding: 0 20rpx; background-color: #f0f5ff; height: 100vh; box-sizing: border-box; } .header { display: flex; justify-content: center; padding: 20rpx 0; } .title { font-size: 36rpx; font-weight: bold; color: #ffffff; background-color: #2b81f5; padding: 10rpx 40rpx; border-radius: 10rpx; } .content { height: calc(100vh - 140rpx); overflow-y: auto; } .history-item { background-color: #ffffff; border-radius: 15rpx; padding: 20rpx; margin-bottom: 20rpx; } .original { margin-bottom: 10rpx; } .original-text { font-size: 28rpx; color: #333333; } .language-info { display: flex; align-items: center; color: #666666; font-size: 24rpx; } .language-pair { margin-right: 10rpx; } .arrow { margin: 0 5rpx; } .empty-history { display: flex; justify-content: center; align-items: center; height: 100%; } .empty-text { font-size: 32rpx; color: #999999; } .footer { position: fixed; bottom: 0; width: 100%; display: flex; justify-content: space-around; background-color: #ffffff; padding: 15rpx 0; border-top: 1px solid #e0e0e0; } .translate-btn { display: flex; flex-direction: column; align-items: center; } .translate-icon { display: inline-block; width: 40rpx; height: 40rpx; background-color: #2b81f5; border-radius: 50%; margin-bottom: 5rpx; } </style> <template> <view class="container"> <view class="header"> <navigator open-type="navigateBack" class="back-btn"> <text class="back-icon"></text> </navigator> <text class="title">翻译结果</text> </view> <view class="content"> <view class="language-info"> <text class="language-pair">{{languagePair}}</text> <text class="delete-btn" @click="deleteTranslation">删除</text> </view> <view class="divider"></view> <view class="original-section"> <text class="section-title">原文</text> <text class="original-text">{{originalText}}</text> </view> <view class="divider"></view> <view class="translation-section"> <text class="section-title">译文</text> <text class="translation-text">{{translationText}}</text> </view> </view> </view> </template> <script> export default { data() { return { languageCodes: { 'zh-CHS': '简体中文', 'zh-CHT': '繁体中文', 'en': '英文', 'ja': '日文', 'ko': '韩文', 'fr': '法文', 'es': '西班牙文' }, originalText: '', translationText: '', from: '', to: '', languagePair: '' }; }, onLoad(options) { this.originalText = decodeURIComponent(options.original); this.translationText = decodeURIComponent(options.translation); this.from = options.from; this.to = options.to; this.languagePair = `${this.languageCodes[this.from]}->${this.languageCodes[this.to]}`; }, methods: { deleteTranslation() { const history = uni.getStorageSync('translationHistory') || []; const updatedHistory = history.filter(item => item.original !== this.originalText || item.from !== this.from || item.to !== this.to ); uni.setStorageSync('translationHistory', updatedHistory); uni.showToast({ title: '已删除', icon: 'success' }); uni.navigateBack(); } } }; </script> <style scoped> .container { padding: 0 20rpx; background-color: #f0f5ff; height: 100vh; box-sizing: border-box; position: relative; } .header { display: flex; align-items: center; padding: 20rpx 0; } .back-btn { position: absolute; left: 20rpx; top: 20rpx; } .back-icon { display: inline-block; width: 40rpx; height: 40rpx; border: 2px solid #2b81f5; border-radius: 50%; transform: rotate(45deg); margin-right: 20rpx; } .title { font-size: 36rpx; font-weight: bold; color: #ffffff; background-color: #2b81f5; padding: 10rpx 40rpx; border-radius: 10rpx; margin: 0 auto; } .content { background-color: #ffffff; border-radius: 15rpx; padding: 30rpx; margin-bottom: 20rpx; } .language-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20rpx; } .language-pair { font-size: 28rpx; color: #333333; } .delete-btn { font-size: 24rpx; color: #ff5252; } .divider { height: 1px; background-color: #e0e0e0; margin: 20rpx 0; } .section-title { font-size: 28rpx; color: #666666; margin-bottom: 10rpx; } .original-text, .translation-text { font-size: 32rpx; color: #333333; line-height: 1.5; } </style> <template> <view class="container"> <view class="header"> <text class="title">智云翻译</text> </view> <view class="content"> <view class="language-selector"> <text class="label">源语言</text> <picker mode="selector" :range="languages" @change="onSourceLanguageChange"> <view class="picker">{{ sourceLanguage }}</view> </picker> </view> <view class="language-selector"> <text class="label">目标语言</text> <picker mode="selector" :range="languages" @change="onTargetLanguageChange"> <view class="picker">{{ targetLanguage }}</view> </picker> </view> <view class="input-area"> <textarea v-model="inputText" placeholder="请输入要翻译的文本" @input="onInput" /> </view> <view class="button-group"> <button class="btn reset-btn" @click="reset">重置</button> <button class="btn translate-btn" @click="translate">翻译</button> </view> </view> <view class="footer"> <navigator url="/pages/history/history" class="history-btn"> <text class="icon history-icon"></text> <text class="text">历史</text> </navigator> <navigator url="/pages/translate/translate" class="translate-btn"> <text class="icon translate-icon"></text> <text class="text">翻译</text> </navigator> </view> </view> </template> <script> import axios from 'axios'; export default { data() { return { appKey: 'YOUR_APP_KEY', // 替换为你的应用ID appSecret: 'YOUR_APP_SECRET', // 替换为你的应用密钥 languages: ['简体中文', '繁体中文', '英文', '日文', '韩文', '法文', '西班牙文'], languageCodes: { '简体中文': 'zh-CHS', '繁体中文': 'zh-CHT', '英文': 'en', '日文': 'ja', '韩文': 'ko', '法文': 'fr', '西班牙文': 'es' }, sourceLanguage: '英文', targetLanguage: '简体中文', inputText: '' }; }, methods: { onSourceLanguageChange(e) { this.sourceLanguage = this.languages[e.detail.value]; }, onTargetLanguageChange(e) { this.targetLanguage = this.languages[e.detail.value]; }, onInput(e) { this.inputText = e.detail.value; }, reset() { this.inputText = ''; }, async translate() { if (!this.inputText.trim()) { uni.showToast({ title: '请输入要翻译的文本', icon: 'none' }); return; } const sourceCode = this.languageCodes[this.sourceLanguage]; const targetCode = this.languageCodes[this.targetLanguage]; try { const salt = Date.now().toString(); const curtime = Math.round(Date.now() / 1000); const signStr = this.appKey + this.truncate(this.inputText) + salt + curtime + this.appSecret; const sign = this.sha256(signStr); const url = 'https://openapi.youdao.com/api'; const response = await axios.post(url, null, { params: { q: this.inputText, from: sourceCode, to: targetCode, appKey: this.appKey, salt: salt, sign: sign, signType: 'v3', curtime: curtime } }); if (response.data.errorCode === '0') { this.saveTranslationHistory(this.inputText, response.data.translation[0], sourceCode, targetCode); uni.navigateTo({ url: `/pages/result/result?original=${encodeURIComponent(this.inputText)}&translation=${encodeURIComponent(response.data.translation[0])}&from=${sourceCode}&to=${targetCode}` }); } else { uni.showToast({ title: `翻译失败: ${response.data.errorCode}`, icon: 'none' }); } } catch (error) { console.error('翻译失败:', error); uni.showToast({ title: '翻译失败,请重试', icon: 'none' }); } }, truncate(q) { const len = q.length; if (len <= 20) return q; return q.substring(0, 10) + len + q.substring(len - 10, len); }, sha256(str) { return 'mock-sha256-sign'; }, saveTranslationHistory(original, translation, from, to) { const history = uni.getStorageSync('translationHistory') || []; history.unshift({ original, translation, from, to, timestamp: Date.now() }); if (history.length > 50) { history.pop(); } uni.setStorageSync('translationHistory', history); } } }; </script> <style scoped> .container { padding: 20rpx; background-color: #f0f5ff; height: 100vh; box-sizing: border-box; } .header { display: flex; justify-content: center; padding: 20rpx 0; } .title { font-size: 36rpx; font-weight: bold; color: #ffffff; background-color: #2b81f5; padding: 10rpx 40rpx; border-radius: 10rpx; } .content { background-color: #ffffff; border-radius: 15rpx; padding: 30rpx; margin-bottom: 20rpx; } .language-selector { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20rpx; } .label { font-size: 28rpx; color: #666666; } .picker { font-size: 28rpx; color: #333333; } .input-area { width: 100%; height: 300rpx; background-color: #f8f8f8; border-radius: 10rpx; padding: 20rpx; margin-bottom: 20rpx; } textarea { width: 100%; height: 100%; font-size: 28rpx; line-height: 1.5; } .button-group { display: flex; justify-content: space-between; } .btn { width: 48%; height: 80rpx; line-height: 80rpx; text-align: center; font-size: 30rpx; color: #ffffff; border-radius: 10rpx; } .reset-btn { background-color: #f0f0f0; color: #333333; } .translate-btn { background-color: #2b81f5; } .footer { position: fixed; bottom: 0; width: 100%; display: flex; justify-content: space-around; background-color: #ffffff; padding: 15rpx 0; border-top: 1px solid #e0e0e0; } .history-btn, .translate-btn { display: flex; flex-direction: column; align-items: center; } .history-icon, .translate-icon { display: inline-block; width: 40rpx; height: 40rpx; background-color: #2b81f5; border-radius: 50%; margin-bottom: 5rpx; } .text { font-size: 24rpx; color: #666666; } </style> <template> <view> <navigator url="/pages/translate/translate"> <view class="app-icon"></view> <text class="app-title">智云翻译</text> </navigator> </view> </template> <script> export default { name: 'App' }; </script> <style> .app-icon { display: inline-block; width: 100px; height: 100px; background-color: #2b81f5; border-radius: 20px; margin: 100px auto; } .app-title { font-size: 24px; text-align: center; color: #333; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script> var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) document.write( '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />') </script> <title></title> </head> <body> <div id="app"><!--app-html--></div> <script type="module" src="/main.js"></script> </body> </html> import App from './App' // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) return { app } } import { createApp } from 'vue'; import App from './App.vue'; const app = createApp(App); app.mount('#app'); // #endif { "pages": [ { "path": "pages/translate/translate", "style": { "navigationBarTitleText": "翻译" } }, { "path": "pages/result/result", "style": { "navigationBarTitleText": "翻译结果" } }, { "path": "pages/history/history", "style": { "navigationBarTitleText": "历史记录" } } ], "window": { "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black", "navigationBarTitleText": "智云翻译", "backgroundColor": "#ffffff", "pullRefresh": { "enable": true } } }
05-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值