zoukankan      html  css  js  c++  java
  • 01-路由跳转 安装less this.$router.replace(path) 解决vue/cli3.0语法报错问题

    2==解决vue2.0里面控制台包的一些语法错误。

    https://www.jianshu.com/p/5e0a1541418b

    在build==>webpack.base.conf.j
    下注释掉 ...(config.dev.useEslint ? [createLintingRule()] : []),
    rules: [
    // ...(config.dev.useEslint ? [createLintingRule()] : []),
    {
    test: /.vue$/,
    loader: "vue-loader",
    options: vueLoaderConfig
    },

    解决vue/cli3.0语法报错问题

    https://www.cnblogs.com/sjie/p/9884362.html

    3==>
    vue使用less报错的解决方法 安装less less-loader
    cnpm install less less-loader --save-dev


    4.1
    app.vue是所有XXX.vue文件的根文件
    所以webapp,的底部通常是在这里配置


    4==》h5的新增
    <header>标题</header>
    <main>主题内容</main>
    <footer>固定的底部内容</footer>
    所以底部通常不使用footer


    5==>元素在最底部水平排列
    <div class="myfooterbox">
    <div>外卖</div>
    <div>搜索</div>
    <div>订单</div>
    <div>我的</div>
    </div>

    .myfooterbox {
    100%;
    display: flex;
    justify-content: space-between;
    position: fixed;
    bottom: 0;
    left: 0;
    }
    ps==>如果元素的宽度是自身的宽度。
    justify-content: space-between;可能是是没有效果的。

    6==》点击路由跳转
    this.$router.push({ path: "/search" });

    7==》给当前点击的元素添加背景色 同样是借助三目运算 如果是true 添加某一个类

    .on {
    background: pink;
    }

    <div @click="handlersell" :class="{ on: '/' === $route.path }">外卖</div>
    <div @click="handlersearch" :class="{ on: '/search' === $route.path }">搜索</div>


    8==》 路由跳转
    <div @click="handlersell" :class="{ on: '/' === $route.path }">外卖</div>
    <div @click="handlersearch" :class="{ on: '/search' === $route.path }">搜所 </div>

    methods: {
    handlersell() {
    this.$router.push({ path: "/" });
    },
    handlersearch() {
    this.$router.push({ path: "/search" });
    },
    }

    优化后 使用了replace
    <div @click="handlergo('/')" :class="{ on: '/' === $route.path }">外卖</div>
    <div @click="handlergo('/search')" :class="{ on: '/search' === $route.path }" >搜索</div>

    handlergo(path) {
    this.$router.replace(path);
    }


    11ok

  • 相关阅读:
    网页尺寸scrollHeight
    浏览器窗口可视区域大小
    创建文本节点createTextNode
    创建元素节点createElement
    faster rcnn需要理解的地方
    3d点云
    多维的vector定义和初始化
    写代码的可扩展性
    1111
    tmux命令
  • 原文地址:https://www.cnblogs.com/IwishIcould/p/11877572.html
Copyright © 2011-2022 走看看