• 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

  • 相关阅读:
    centos7时间不同步,ntpd时间同步服务
    centos7.6离线安装docker
    安装虚拟机总是获取不到IP地址的解决办法
    安装英伟显卡,出现报错总结
    在ubuntu 安装make
    if,while,for脚本小练习
    python输入密码-隐藏
    Python修改headers参数的两种方法
    Python爬虫 —POST请求有道翻译{"errorcode":50}
    列表转换为字典
  • 原文地址:https://www.cnblogs.com/IwishIcould/p/11877572.html
Copyright © 2020-2023  润新知