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 {
width: 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

相关文章

https://segmentfault.com/a/1190000022018995 https://www....
ES6 (ECMAScript 6)中的模块是一个包含 JavaScript 代码的...
from https://mp.weixin.qq.com/s/-rc1lYYlsfx-wR4mQmIIQQ V...
D:\Temp&gt;npm init vite@latest vue3study --temp...
文章浏览阅读1.2k次。最近自己从零撸起的甘特图组件需要子组...
文章浏览阅读3.3k次,点赞3次,收藏16次。静默打印是什么?简...