1. 开关
<switch style="transform: scale(0.7,0.6)" color="#F8D02D"></switch>
2. placeholder颜色
<input placeholder="请输入姓名" placeholder-style="color:#D2D2D2;font-size:24rpx" />
3. 选择本地上传弹框
uploading() {
var that = this
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
console.log("获取到的路径", tempFilePaths[0]);
that.imgs = tempFilePaths[0];
console.log("获取到的数据", that.imgs);
uni.uploadFile({
url: 'http://122.51.124.106:8081/file/upload/file',
filePath: tempFilePaths[0],
name: 'file',
success: (uploadFileRes) => {
console.log(uploadFileRes.data);
that.image = uploadFileRes.data.split("\"")[7];
console.log("打印内容" + uploadFileRes.data.split("\"")[7]);
}
})
}
})
}
4. 优惠券
侧边圆角
https://blog.csdn.net/pinena/article/details/89708024
5.内容居中对其
display: flex;
justify-content: center;
align-items: center;
6.自定义导航栏
<uni-nav-bar left-icon="back" title="评价" background-color="#f8d02d"></uni-nav-bar>
<uni-nav-bar :statusBar="true" rightText="发布" left-icon="back" @click-left="back" @click-right="submit">
7.底部固定
position:fixed;
bottom:0;
left:0;
顶部固定
position:fixed;
top:0;
left:0;
8.登陆注册判断
save(){
if(this.phone==''){
uni.showToast({
title: '手机号不能为空',
duration: 2000,
image:'../../static/images/err.png'
});
return;
}
if(this.password==''){
uni.showToast({
title: '密码不能为空',
duration: 2000,
image:'../../static/images/err.png'
});
return;
}
if(this.note==''){
uni.showToast({
title: '验证码不能为空',
duration: 2000,
image:'../../static/images/err.png'
});
return;
}
else if(this.phone.length==10){
uni.showToast({
title:'请输入正确的手机号!',
icon:'none'
})
return;
}
else if(this.password.length<=5){
uni.showToast({
title:'密码不能少于六位!',
icon:'none'
})
return;
}
else if(this.note.length==5){
uni.showToast({
title:'验证码为六位!',
icon:'none'
})
return;
}
if(this.newpassword != this.password){
uni.showToast({
title: '密码不一致',
duration: 2000,
image:'../../static/images/err.png'
});
return;
}
},
9.页面跳转
//在起始页面跳转到test.vue页面并传递参数
uni.navigateTo({
url: 'test?id=1&name=uniapp'
});
保留当前页面,跳转到应用内的某个页面,使用`uni.navigateBack`可以返回到原页面。
// 在test.vue页面接受参数
export default {
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
console.log(option.id); //打印出上个页面传递的参数。
console.log(option.name); //打印出上个页面传递的参数。
}
}
uni.redirectTo // 关闭当前页面,跳转到应用内的某个页面。
uni.switchTab //跳转到 tabBar 页面只能使用 switchTab 跳转,并关闭其他所有非 tabBar 页面。
uni.reLaunch //关闭所有页面,打开到应用内的某个页面。
uni.navigateBack// 关闭当前页面,返回上一页面或多级页面。可通过 `getCurrentPages()` 获取当前的页面栈,决定需要返回几层。
10.choose点击
乐推
“path”: “pages/couple/delete”,
<template>
<view>
<image :src="allImg" v-if="allState" @tap="check(allState)" class="circle"></image>
</view>
</template>
<script>
export default {
// 页面引入插件集合
components: {
},
data() {
return {
allImg:"../../static/img/weixuan.png",
allState:"false",
}
},
methods:{
check:function(allState){
console.log("方法触发"+allState)
if(allState == "false"){
console.log("判断1")
this.allState = "true";
this.allImg = "../../static/img/yixuan.png";
for(var i = 0 ;i<this.list.length; i++){
this.list[i].state = "true";
this.list[i].img = "../../static/img/yixuan.png";
}
this.num = i;
}
if(allState == "true"){
console.log("判断2")
this.allState = "false";
this.allImg = "../../static/img/weixuan.png";
for(var i = 0 ;i<this.list.length; i++){
this.list[i].state = "false";
this.list[i].img = "../../static/img/weixuan.png";
}
this.num = 0;
}
},
}
</script>
<style>
.circle{margin:40rpx;width: 31rpx;height: 31rpx;}
</style>
11.获取验证码
getCode:function(){
if (this.getcode == false)
var time = 60
var that=this;
that.timer= setInterval(function() {
time--;
if (time <= 0) {
clearInterval(that.timer)
that.timer= null
that.msg = "重新获取验证码"
that.getcode = false
} else {
that.msg = time + "s"
}
}, 1000)
this.getcode = true;
}
12.banner滑动
<template>
<view class="huadong">
<swiper class="swiper" previous-margin="80rpx" next-margin="80rpx" circular="true" indicator-dots="true" autoplay="true" interval="2000" duration="500">
<swiper-item v-for="(item, index) in imagess" :key="index">
<image :src="item.image" ></image>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default{
props:{
},
data(){
return{
imagess:[
{
image:"../../static/img/banner1.jpg"
},
{
image:"../../static/img/banner2.jpg"
},
{
image:"../../static/img/banner3.png"
},
],
}
}
}
</script>
<style>
</style>
13.弹窗弹出popup
https://ext.dcloud.net.cn/plugin?id=329
14.gitee上传
小白鸽上传
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git config --global user.name
xyh
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git config --global user.email
6514081+xiao_yan_hui@user.noreply.gitee.com
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git init
Initialized empty Git repository in D:/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige/.git/
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git add .
warning: LF will be replaced by CRLF in App.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in main.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in manifest.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index2.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index3.vue.
The file will have its original line endings in your working directory
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: App.vue
new file: main.js
new file: manifest.json
new file: pages.json
new file: pages/index/index.vue
new file: pages/index/index2.vue
new file: pages/index/index3.vue
new file: static/default.png
new file: static/more.png
new file: static/right.png
new file: static/search2.png
new file: uni.scss
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git commit -m "first"
[master (root-commit) 4064e87] first
12 files changed, 969 insertions(+)
create mode 100644 App.vue
create mode 100644 main.js
create mode 100644 manifest.json
create mode 100644 pages.json
create mode 100644 pages/index/index.vue
create mode 100644 pages/index/index2.vue
create mode 100644 pages/index/index3.vue
create mode 100644 static/default.png
create mode 100644 static/more.png
create mode 100644 static/right.png
create mode 100644 static/search2.png
create mode 100644 uni.scss
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git status
On branch master
nothing to commit, working tree clean
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git remote add origin https://gitee.com/cypress_elephants/code_of_xiao_yanhui.git
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git push -u origin master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 9.29 KiB | 594.00 KiB/s, done.
Total 17 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/cypress_elephants/code_of_xiao_yanhui.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$
.text上传
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git config --global user.name
xyh
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git config --global user.email
6514081+xiao_yan_hui@user.noreply.gitee.com
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige
$ git init
Initialized empty Git repository in D:/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige/.git/
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git add .
warning: LF will be replaced by CRLF in App.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in main.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in manifest.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index2.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/index/index3.vue.
The file will have its original line endings in your working directory
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: App.vue
new file: main.js
new file: manifest.json
new file: pages.json
new file: pages/index/index.vue
new file: pages/index/index2.vue
new file: pages/index/index3.vue
new file: static/default.png
new file: static/more.png
new file: static/right.png
new file: static/search2.png
new file: uni.scss
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git commit -m "first"
[master (root-commit) 4064e87] first
12 files changed, 969 insertions(+)
create mode 100644 App.vue
create mode 100644 main.js
create mode 100644 manifest.json
create mode 100644 pages.json
create mode 100644 pages/index/index.vue
create mode 100644 pages/index/index2.vue
create mode 100644 pages/index/index3.vue
create mode 100644 static/default.png
create mode 100644 static/more.png
create mode 100644 static/right.png
create mode 100644 static/search2.png
create mode 100644 uni.scss
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git status
On branch master
nothing to commit, working tree clean
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git remote add origin https://gitee.com/cypress_elephants/code_of_xiao_yanhui.git
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$ git push -u origin master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 9.29 KiB | 594.00 KiB/s, done.
Total 17 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/cypress_elephants/code_of_xiao_yanhui.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Admibion@DESKTOP-UNJJJCV MINGW64 /d/360MoveData/Users/Admibion/Documents/HBuilderProjects/xiaobaige (master)
$
mkdir xiao
cd xiao
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/xiao_yan_hui/xiao.git
git push -u origin master
15.gitlab上传步骤
git init
git remote add origin...
git add .
git status (可省略)
git commit -m "add README"
git push -u origin master
重置账户名;密码
输入密码默认看不见
解决git一直输入用户名和密码的问题: git config --system --unset credential.helper
16.gitlab分支步骤
git branch -a
git branch (分支name)
git branch -a
git checkout (分支name)
git branch
git add .
git commit -m "upload"
git push origin (分支name)
17.gitlab分支
$ git branch -a
* master
remotes/origin/master
$ git branch newxyh
$ git branch -a
* master
newxyh
remotes/origin/master
$ git checkout newxyh
Switched to branch 'newxyh'
$ git branch
master
* newxyh
$ git add .
$ git commit -m "second upload"
[newxyh 5645d68] second upload
1 file changed, 1 insertion(+)
$ git push origin newxyh
Username for 'http://39.107.123.201:8099': 1050506597@qq.com
Password for 'http://1050506597@qq.com@39.107.123.201:8099':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 273 bytes | 136.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://39.107.123.201:8099/xiao/test.git
* [new branch] newxyh -> newxyh
18.学习链接
前端基础实战项目教程:https://www.bilibili.com/video/BV1ZE411c7yM/
前端Vue实战项目教程: https://www.bilibili.com/video/BV1m741137Q5/
Vue企业项目实战:https://www.bilibili.com/video/BV1K541147rV/
前端React框架实战项目教程: https://www.bilibili.com/video/BV1T7411W72T/
前端React-Native实战项目教程:https://www.bilibili.com/video/BV1nE411N7js/
前端Angular实战项目教程: https://www.bilibili.com/video/BV1i741157Fj/
前端小程序实战项目教程:https://www.bilibili.com/video/BV187411c7Bi/
前端Es6实战教程: https://www.bilibili.com/video/BV1v7411G7Ht/
Node、MongoDB、爬虫实战项目教程:https://www.bilibili.com/video/BV1i7411y7k6/
Node、Mysql、Express、爬虫实战项目教程:https://www.bilibili.com/video/BV1i7411G7kW/
前端面试题:https://www.bilibili.com/video/BV1w7411d7rC/
19.tabbar
<template>
<div class='tabbar'>
<ul>
<li @click="go(item.path)"
:class="{active:message==item.path}"
v-for="(item,index) in atabs">
<img :src="message==item.path?item.icon_active:item.icon"
alt="">
{{item.title}}
</li>
</ul>
</div>
</template>
<script>
export default {
props: {
selected: String,
},
name: 'tabbar',
data () {
return {
message: this.selected,
atabs: [
{ title: '首页', path: 'index', icon: require('@/assets/index.png'), icon_active: require('@/assets/indexS.png') },
{ title: '分类', path: 'index', icon: require('@/assets/kind.png'), icon_active: require('@/assets/kindS.png') },
{ title: '购物车', path: 'index', icon: require('@/assets/shop.png'), icon_active: require('@/assets/shopS.png') },
{ title: '我的', path: 'index', icon: require('@/assets/my.png'), icon_active: require('@/assets/myS.png') }
]
}
},
methods: {
go (url) {
this.$router.push(`/${url}`)
}
},
}
</script>
<style>
*{
margin: 0;
padding: 0;
}
.tabbar {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 0.45rem;
border: 1px solid #000;
}
ul {
width: 100%;
height: 100%;
display: flex;
justify-content: space-around;
background-color: #fff;
}
li {
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
text-align: center;
border-top: 1px solid #eaeaea;
font-size: 0.1rem;
}
img {
width: 0.2rem;
height: 0.2rem;
margin: 5px auto 0px;
}
.active {
color: #ff5621;
font-weight: bold;
}
</style>
20.swiper滑动切换
<template>
<swiper ref="mySwiper" :options="swiperOptions">
<swiper-slide v-for="(item,index) in banners" :key="index">
<img :src="item.image_input" alt="" width="100%">
</swiper-slide>
</swiper>
</template>
<script>
import axios from 'axios'
export default {
name: 'Banner',
data() {
return {
banners:[],
swiperOptions: {
pagination: {
el: '.swiper-pagination',
},
// Some Swiper option/callback...
//循环播放
loop:true,
//自动播放
autoplay: {
delay: 1500,
stopOnLastSlide: false,
disableOnInteraction: false
}
}
}
},
computed: {
swiper() {
return this.$refs.mySwiper.$swiper
}
},
mounted:function(){
console.log('Current Swiper instance object', this.swiper)
this.swiper.slideTo(1, 1000, true)
axios
.get('/api/article/banner/list')
.then(res=>{this.banners = res.data.data;console.log(res)})
.catch(err=>console.log(err))
}
}
</script>
<style>
.title{position:absolute;left:5vw;bottom:0;line-height:50px}
</style>
21.自定义导航栏
<template>
<view>
<view class="status_bar">
<!-- 这里是状态栏 -->
</view>
<view> 状态栏下的文字 </view>
</view>
</template>
<style>
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
</style>