Date: 2021/12/6Category: Tag: Vue, wechat
总结下在 vue 2.6 下微信公众号的微网站授权登录方案
在Vue中绑定键盘按键,并触发事件
问题描述: 在做项目的时候遇到 使用键盘的左右键来翻页的功能,一开始想当然的使用JS的绑定键盘事件发现并不好用 在Vue中要借用$nextTick来处理一下
created() {
//监听左右箭头按键的键盘按下事件
this.$nextTick(() => {
document.onkeydown = (e) => {
if (e.keyCode == 39 && this.currentPage < this.pageCount) {
//这是右箭头,
this.currentPage++;
} else if (e.keyCode == 37 && this.currentPage > 1) {
//这是左箭头,
this.currentPage--;
}
};
});
}
内容如图尽量保证js文件名称与页面文件名称相同(易于查找)
注意: 1.scroll竖直滚动高度不能给百分比要给px/rpx 2.swiper内部item posiiton定位高度100% 3.swiper高度要给定值 4.如果横向滚动也要给水平的宽度
xml
<swiper class="tab-box" current="{{currentTab}}" duration="300" bindchange="switchTab">
<swiper-item class="tab-content">
<scroll-view class="scroll-height" scroll-y="true" scroll-with-animation="{{true}}">
<view class="cont">
<view class="jira-card" wx:for="{{jiraArray}}" wx:for-index="idx" wx:for-item="itemJira" wx:key="idx">
<card itemJira="{{itemJira}}" data-item="{{itemJira}}" bindtap="goDetail"></card>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="tab-content">
<scroll-view class="scroll-height" scroll-y="true" scroll-with-animation="{{true}}">
<view class="cont">
<view class="jira-card" wx:for="{{jiraArray}}" wx:for-index="idx" wx:for-item="itemJira" wx:key="idx">
<card itemJira="{{itemJira}}" data-item="{{itemJira}}" bindtap="goDetail"></card>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<view class="jira-card" wx:for="{{jiraArray}}" wx:for-index="idx" wx:for-item="itemJira" wx:key="idx">
<card itemJira="{{itemJira}}" data-item="{{itemJira}}" bindtap="goDetail"></card>
</view>
安装Koa插件时遇到的问题
问题描述:
电脑中缺少python环境和桌面应用程序
解决方法: 用Powershell或者cmd 用管理员身份打开
npm install --global --production windows-build-tools
<view class="submit" style="bottom:{{bottom}}px">
<view class="serch-view">
<input bindconfirm="toSubmit"
value="{{code}}"
bindfocus="inputFocus"
bindblur="inputBlur"
adjust-position="{{false}}"
class="block-main"
type="text"
confirm-type="go"
cursor-spacing="100" class="course-search"></input>
<view bindtap="search" class="search-button">发 送</view>
</view>
vue 参数为html
<div v-html="someData"></div>