Skip to content

Commit

Permalink
pc update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasttian committed Jan 29, 2021
1 parent 0b504c8 commit 8a478cb
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/uni-datetime-picker/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"edition": "0.0.3",
"suffix": "vue",
"path": "https://ext.dcloud.net.cn/plugin?id=9999",
"hidden": true,
"hidden": false,
"update_log": "- 修复 start 和 end 重合造成的日期范围错误的 bug"
}
45 changes: 45 additions & 0 deletions components/uni-drawer/keypress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// #ifdef H5
export default {
name: 'Keypress',
props: {
disable: {
type: Boolean,
default: false
}
},
mounted () {
const keyNames = {
esc: ['Esc', 'Escape'],
tab: 'Tab',
enter: 'Enter',
space: [' ', 'Spacebar'],
up: ['Up', 'ArrowUp'],
left: ['Left', 'ArrowLeft'],
right: ['Right', 'ArrowRight'],
down: ['Down', 'ArrowDown'],
delete: ['Backspace', 'Delete', 'Del']
}
const listener = ($event) => {
if (this.disable) {
return
}
const keyName = Object.keys(keyNames).find(key => {
const keyName = $event.key
const value = keyNames[key]
return value === keyName || (Array.isArray(value) && value.includes(keyName))
})
if (keyName) {
// 避免和其他按键事件冲突
setTimeout(() => {
this.$emit(keyName, {})
}, 0)
}
}
document.addEventListener('keyup', listener)
this.$once('hook:beforeDestroy', () => {
document.removeEventListener('keyup', listener)
})
},
render: () => {}
}
// #endif
17 changes: 14 additions & 3 deletions components/uni-drawer/uni-drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
<view class="uni-drawer__mask" :class="{ 'uni-drawer__mask--visible': showDrawer && mask }" @tap="close('mask')" />
<view class="uni-drawer__content" :class="{'uni-drawer--right': rightMode,'uni-drawer--left': !rightMode, 'uni-drawer__content--visible': showDrawer}" :style="{width:drawerWidth+'px'}">
<slot />
</view>
</view>
<!-- #ifdef H5 -->
<keypress @esc="close('mask')" />
<!-- #endif -->
</view>
</template>

<script>
<script>
// #ifdef H5
import keypress from './keypress.js'
// #endif
/**
* Drawer 抽屉
* @description 抽屉侧滑菜单
Expand All @@ -21,7 +27,12 @@
* @event {Function} close 组件关闭时触发事件
*/
export default {
name: 'UniDrawer',
name: 'UniDrawer',
components: {
// #ifdef H5
keypress
// #endif
},
props: {
/**
* 显示模式(左、右),只在初始化生效
Expand Down
2 changes: 1 addition & 1 deletion components/uni-swipe-action-item/index.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function isPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true;
for (let v = 0; v < Agents.length - 1; v++) {
for (var v = 0; v < Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
Expand Down
10 changes: 6 additions & 4 deletions components/uni-swiper-dot/uni-swiper-dot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@
margin-left: 6px;
background-color: $uni-bg-color-mask;
cursor: pointer;
border-width: 5px 0;
border-style: solid;
border-color: transparent;
background-clip: padding-box;
/* #ifdef H5 */
// border-width: 5px 0;
// border-style: solid;
// border-color: transparent;
// background-clip: padding-box;
/* #endif */
// transition: width 0.2s linear; 不要取消注释,不然会不能变色
}
Expand Down
2 changes: 1 addition & 1 deletion pages/nvue/drawer/drawer.nvue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<text class="example-info">这是抽屉式导航组件使用示例,可以指定菜单左侧或者右侧弹出(仅初始化生效),组件内部可以放置任何内容。点击页面按钮即可显示导航菜单。</text>
<view>
<uni-section title="左侧滑出" class="hideOnPc" type="line"></uni-section>

<view class="example-body">
<view class="word-btn draw-cotrol-btn hideOnPc" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70"
@click="showDrawer('showLeft')"><text class="word-btn-white">显示Drawer</text></view>
Expand Down
2 changes: 1 addition & 1 deletion pages/vue/drawer/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<text class="example-info">这是抽屉式导航组件使用示例,可以指定菜单左侧或者右侧弹出(仅初始化生效),组件内部可以放置任何内容。点击页面按钮即可显示导航菜单。</text>
<view>
<uni-section title="左侧滑出" class="hideOnPc" type="line"></uni-section>

<view class="example-body">
<view class="word-btn draw-cotrol-btn hideOnPc" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70"
@click="showDrawer('showLeft')"><text class="word-btn-white">显示Drawer</text></view>
Expand Down

0 comments on commit 8a478cb

Please sign in to comment.