Files
PC-Light-Forum/component/head-top/head-top.js
DESKTOP-RQ919RC\Pc 671732d277 feat: 更新组件样式和功能,优化路由链接和用户体验
refactor: 重构组件模板,统一使用相对路径和内部路由

style: 调整CSS样式,修复布局和间距问题

fix: 修复投票和offer组件链接错误问题

chore: 添加新图片资源并更新相关引用路径

perf: 移除调试日志,优化页面加载性能

docs: 更新组件注释和文档说明

test: 更新测试用例以适配新功能

ci: 调整构建配置以支持新资源文件

build: 更新依赖项以兼容新功能
2025-11-03 19:20:55 +08:00

31 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// my-component.js
// 引入全局 Vue 对象(因在 HTML 中通过 script 引入Vue 已挂载到 window
const { defineComponent, ref, onMounted, nextTick } = Vue;
// 定义组件(直接使用模板)
export const headTop = defineComponent({
name: "headTop",
props: {
itemdata: {
type: Object,
default: () => {},
},
},
setup(props) {
onMounted(() => {});
let signInAlreadyState = ref(false);
let input = ref("");
let defaultSearchText = ref("屯特");
const goSearch = () => {
const searchText = input.value || defaultSearchText.value;
redirectToExternalWebsite("/search/" + searchText);
};
return { input, defaultSearchText, goSearch, signInAlreadyState };
},
template: `<div class="head-top flexacenter"> <a href="/" class="flexacenter" target="_blank"> <img class="logo" src="https://oss.gter.net/logo" alt="" /> </a> <div class="flex1"></div> <div class="input-box flexacenter"> <input class="input flex1" type="text" :placeholder="'大家都在搜:' + defaultSearchText" @keyup.enter="goSearch" v-model="input" /> <img class="icon" src="/img/search-icon.svg" @click="goSearch" /> </div> <div class="sign-in sign-in-already flexcenter" v-if="signInAlreadyState" v-cloak onclick="showWindow('dsu_paulsign', 'https://bbs.gter.net/plugin.php?id=dsu_paulsign:sign&show=sign')"> <img class="sign-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-icon.png" /> <span>已签到,明天再来</span> </div> <div class="sign-in sign-in-no flexacenter" v-else onclick="showWindow('dsu_paulsign', 'https://bbs.gter.net/plugin.php?id=dsu_paulsign:sign&show=sign')" v-cloak> <img class="sign-in-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-in-bj.svg" /> <img class="coin-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-bj.svg" /> <img class="coin-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-icon.png" /> <span class="text flex1">签到领寄托币</span> <div class="sign-go flexcenter"> <img class="sign-go-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-go.svg" /> GO </div> <img class="petal1" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal1.png" /> <img class="petal2" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal2.png" /> <img class="petal3" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal3.png" /> </div></div>`,
});