scroll-up-el
v0.2.3
Published
> A vue3.x component/一个vue3.x的组件
Downloads
8
Readme
scroll-up-el
A vue3.x component/一个vue3.x的组件
安装
npm i scroll-up-el
演示
scrollType = 1
scrollType = 2
使用
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import './index.css'
import scollUpEl from "scroll-up-el"
createApp(App).use(scollUpEl).mount('#app');
<!-- Vue -->
<template>
<div class="scroll">
<scroll-up-el :data="list" :intTime="1000" isMouseenter @row-click="rowClick">
<template #default="scope">
<!-- scope.data.name 是根据Data的值决定 -->
<div class="scroll_item">{{ scope.data.name }}</div>
</template>
</scroll-up-el>
</div>
</template>
<script>
import { reactive, ref } from "vue";
export default {
setup() {
const list = reactive([
{
name: "wang",
type: 1,
},
{
name: "da",
type: 2,
},
{
name: "pang",
type: 3,
},
{
name: "zi",
type: 4,
},
]);
const rowClick = row => {
console.log(row)
}
return {
list,
rowClick
};
},
};
</script>
<style scoped>
.scroll {
width: 200px;
background: rosybrown;
}
.scroll_item {
width: 100%;
height: 50px;
text-align: center;
line-height: 50px;
}
</style>
属性
| 属性 | 说明 | 类型 | 默认值 | 必填 | 可选值 | | ------------ | -------------------- | -------------- | ------ | ----- | ------ | | data | 滚动列表 | Array | -- | True | -- | | intTime | 停留时间, 最低500 | Number | 1000 | True | -- | | isMouseenter | 鼠标移入是否停止滚动 | Boolean | false | False | -- | | scrollType | 滚动类型 | String, Number | 1 | False | 1, 2 |
方法
| 方法 | 说明 | 回调参数 | | --------- | ---------------------------- | -------- | | row-click | 当某一行被点击时会触发该事件 | row |