🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

ollo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ollo - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+2
-2
index.d.ts

@@ -1,3 +0,3 @@

import { Plugin as VuePlugin } from 'vue';
import { Plugin } from 'vue';
export function scroller(): VuePlugin;
export const scroller: Plugin;
+36
-17

@@ -7,23 +7,42 @@ /**

function scroller() {
return {
install(app) {
app.directive('scroll', el => {
el.addEventListener('touchstart', () => {
if (el.scrollTop === 0) {
el.scrollTop = 1;
}
});
el.addEventListener('touchmove', event => {
if (el.offsetHeight < el.scrollHeight) {
event._isScroller = true;
}
});
});
}
};
function __touchmoveCb(event) {
if (this.offsetHeight < this.scrollHeight) {
event._isScroller = true;
}
}
function __touchstartCb() {
if (this.scrollTop === 0) {
this.scrollTop = 1;
}
}
const scroller = {
install(app) {
app.directive('scroll', (el, binding) => {
const { value } = binding;
if (el.__bindScroll) {
if (value || value === undefined) {
return;
}
el.__bindScroll = undefined;
el.removeEventListener('touchstart', __touchstartCb);
el.removeEventListener('touchmove', __touchmoveCb);
return;
}
if (value || value === undefined) {
el.__bindScroll = true;
el.addEventListener('touchstart', __touchstartCb);
el.addEventListener('touchmove', __touchmoveCb);
}
});
}
}
module.exports = {
scroller
};
{
"name": "ollo",
"version": "1.0.0",
"version": "1.0.1",
"description": "公众号H5🈲触顶后允许局部元素滚动解决方案",

@@ -5,0 +5,0 @@ "main": "index.js",

# ollo
## 本插件绑定Vue3环境
## Vue3环境插件
### 注册局部滚动指令
- 支持响应式变量
```ts

@@ -14,2 +18,24 @@ // main.ts (入口文件)

app.use(scroller);
```
```html
<!-- case 1 -->
<template>
<textarea v-scroll />
</template>
<!-- case 2 -->
<template>
<textarea v-scroll="true" />
</template>
<!-- case 3 -->
<template>
<textarea v-scroll="false" />
</template>
<!-- case 4 -->
<template>
<textarea v-scroll="shouldScroll" />
</template>
```