凡尘堕世 2022-03-29 15:06 采纳率: 0%
浏览 23

点击以后路径变了,为啥btn的内容没变

<template>
    <div class="titie-box">
        <div class="logobox">
            <img src="../../assets/logo.png" width="50" height="50" />
            <span>招聘网站</span>
        </div>
        <div class="btn-box">
            <button @click="toggles">{{ btn ? "招聘广场" : "发布招聘" }}</button>
        </div>
    </div>
</template>

<script lang="ts">
import router from "@/router";
import { ref, defineComponent } from "vue"
export default defineComponent({
    setup() {
        let btn = ref(true)
        function toggles() {
            btn = ref(!btn.value)
            if (btn.value) {
                router.push('/recruit')
            } else {
                router.push('/')
            }
        }
        return {
            toggles,
            btn
        }
    }
})
</script>

<style lang="less" scoped>
.titie-box {
    height: 50px;
    display: flex;
    justify-content: space-between;
    margin: 10px;
    border-bottom: 2px solid #ccc;
    padding-bottom: 20px;
    .logobox {
        height: 50px;
        display: flex;
        justify-content: flex-start;
        span {
            line-height: 50px;
            font-weight: 900;
            font-size: 40px;
        }
    }
    .btn-box {
        height: 50px;
        button {
            font-size: 20px;
            background: #fff;
            border: 1px solid currentColor;
            color: #41b883;
            border-radius: 6px;
            padding: 11px 20px;
            cursor: pointer;
        }
    }
}
</style>

  • 写回答

1条回答 默认 最新

  • 渣渣与学霸 2022-03-29 15:43
    关注

    img

    评论

报告相同问题?

问题事件

  • 创建了问题 3月29日

悬赏问题

  • ¥15 Opencv(C++)异常
  • ¥15 VScode上配置C语言环境
  • ¥15 汇编语言没有主程序吗?
  • ¥15 这个函数为什么会爆内存
  • ¥15 无法装系统,grub成了顽固拦路虎
  • ¥15 springboot aop 应用启动异常
  • ¥15 matlab有关债券凸性久期的代码
  • ¥15 lvgl v8.2定时器提前到来
  • ¥15 qtcp 发送数据时偶尔会遇到发送数据失败?用的MSVC编译器(标签-qt|关键词-tcp)
  • ¥15 cam_lidar_calibration报错