Skip to content

Commit

Permalink
Merge pull request #1 from ljtool/dev
Browse files Browse the repository at this point in the history
feat: add scroll-x directives
  • Loading branch information
LinJieLinLin authored May 26, 2023
2 parents 40d0993 + ae946d5 commit 417fff9
Show file tree
Hide file tree
Showing 6 changed files with 1,756 additions and 1,474 deletions.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
},
"devDependencies": {
"@vant/cli": "^6.0.0",
"vue": "^3.0.0",
"sass": "^1.49.7"
"sass": "^1.49.7",
"vue": "^3.0.0"
},
"eslintConfig": {
"root": true,
Expand All @@ -44,8 +44,14 @@
"prettier": {
"singleQuote": true
},
"engines": {
"node": ">=16.0.0"
},
"browserslist": [
"Chrome >= 51",
"iOS >= 10"
]
],
"dependencies": {
"lj-utils": "^0.3.7"
}
}
3,158 changes: 1,688 additions & 1,470 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/demo-button/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
};
</script>

<style lang="scss">
<style scoped lang="scss">
.demo-button {
min-width: 120px;
color: #fff;
Expand Down
31 changes: 31 additions & 0 deletions src/scroll-x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# scrollX PC 鼠标横向滑动 scroll

### 介绍

scrollX PC 鼠标横向滑动 scroll

### 引入

```js
import scrollX from 'lj-utils/directives/scrollX';
directives: {
scrollX: scrollX,
},
// vue3 setup
import vScrollX from 'lj-utils/directive/scrollX';
//
import {scrollX as vScrollX} from 'lj-utils/directive/scrollX';
```

## 代码演示

### 基础用法

```html
<div
v-scroll-x
style="height: 100px; width: 100vw; background: grey; overflow: auto"
>
<div style="width: 200vw; background: grey">test text</div>
</div>
```
18 changes: 18 additions & 0 deletions src/scroll-x/demo/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<demo-block title="鼠标点击内容移动">
<div
id="a"
v-scroll-x
style="height: 100px; width: 100vw; background: grey; overflow: auto"
>
<div style="width: 200vw; background: grey">test text</div>
<div style="width: 200vw; background: grey">
test texttest texttest texttest texttest texttest text
</div>
</div>
</demo-block>
</template>

<script setup>
import { scrollX as vScrollX } from 'lj-utils/directive/scrollX';
</script>
9 changes: 9 additions & 0 deletions vant.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ export default {
},
],
},
{
title: 'directives',
items: [
{
path: 'scroll-x',
title: 'scroll-x pc横向滚动',
},
],
},
],
},
};

0 comments on commit 417fff9

Please sign in to comment.