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