A mobile Vue plugin for Scroller

v-scroller

A mobile Vue plugin for scroller

This plugin is just only adapted for mobile. Please use the rem layout

Please go to the release to see version logs.

Why making this plugin

  • There are so many vue plugins on github,but i haven’t found a suitable mini vue plugin for scroller.The best scroller plugin i have seen is the ‘better-scroller’,however it’s not for vue especially.I decide to make a mini vue scroller plugin for my own company programs also for people who wanna use scroller simply.

What you can do with the plugin

  • You can use it to make a scroller container includes pulling-refresh,infinite-loading and horizonal scroller also supporting nesting different direction scroller.

horizonalMode verticalMode

中文文档

How to use

  • NPM install the v-scroller plugin
yarn add v-scroller   or   npm install v-scroller --save

1.vue spa

  • import the plugin and use
import scroller from 'v-scroller'
import 'v-scroller/dist/v-scroller.css'
Vue.use(scroller)

2.script html

  • directly write the script,in deed you have to insert the vue.js script firstly
<link rel="stylesheet" href="node_modules/v-scroller/dist/v-scroller.css"></link >
<script src="node_modules/v-scroller/dist/v-scroller.js"></script>
  • use the component scroller directly in your vue spa file or the Vue instance
<scroller />

DEMO Codes

<template>
	<!--verticalMode and infinite and refresh-->
	<scroller
		ref="scroll"
		@downFresh="downfresh"
		@upLoad="upload"
		@scroll="showPosition"
		@afterScroll="showPosition"
		:snapping="snapping"
		:smooth="smooth"
		:isDownFresh="isDownFresh"
		:isUpLoad="isUpLoad"
		>
		<div slot="nomore" class="nomore">there is nomore data~</div>
		<ul>
			<li :class="{active:index%2==0}" v-for="(item,index) of num" :key="item">number {{item}} item</li>
		</ul>
	</scroller>

	<!--nesting scroller with horizonalMode and verticalMode-->
	<scroller
		ref="scroll"
		:snapping="snapping"
		@scroll="showPosition"
		@afterScroll="showPosition"
		>
		<div class="_testBox" v-for="item of 20">
			<scroller
				@upLoad="upload"
				:snapping="snapping"
				:isUpLoad="isUpLoad"
				:horizonalMode="horizonalMode"
				>
				<div class="boxRoom">
					<div :class="{active:index%2==0}" class="box" v-for="(item,index) of num" :key="item">{{item}}</div>		
				</div>
			</scroller>
		</div>
		<div slot="nomore" class="nomore">there is nomore data~</div>
	</scroller>
	<!--goTop using the scrollTo() function-->
	<div class="record" @click="goTop">
		x:{{left}},y:{{top}}
	</div>
</template>
<script>
export default{
	data(){
		return{
			num:[],
			snapping:true,
			isDownFresh:true,
			isUpLoad:true,
			smooth:true,
			horizonalMode:true,
			left:0,
			top:0
		}
	},
	created(){
		for(let i=0;i<5;i++){
			this.num.push(i)
		}
	},
	methods:{
		downfresh(done){
			console.log('refreshing finished')
			let b = this.num[0];
			for(let i = b;i>=b-5;i--){
				this.num.unshift(i);
			}
			done() // you should call the done to close the loading
		},
		upload(done){
			console.log('infinite loading finished')
			if(this.num[this.num.length-1]<25){
				let b = this.num[this.num.length-1];
				for(let i = b+1;i<=b+5;i++){
					this.num.push(i);
				}
				done() // you should call the done to close the loading
			}else{
				this.$refs.scroll.closeLoad();
			}
		},
		showPosition(){
			let {x:left,y:top} = this.$refs.scroll.getPosition();
			this.left = left;
			this.top = top;
		},
		goTop(){
			this.$refs.scroll.scrollTo(0,true);
			this.showPosition();
		}
	}
}
</script>

It’s suggested that write a single function for ajax in methods and then use the ajax function at the lifeCircle of created,you can continue to use it at the plugin emiting event – upLoad.Like this:

	created(){
		//when the component created ,use the ajax function firstly
		this.refreshData();
	},
	methods:{
		refreshData(done){
			const data = `telephone=${this.$store.state.BookOrderInfo.telephone}&start=${this.start}&limit=${this.limit}`
			this.$http({
				method:'POST',
				url:this.$_URL+'/api/listHistoryRecord',
				data:data
			})
			.then(
				res=>{
					if(res.data.code == '0000'){
						//if nomore data from the back-end ,use the plugin function closeLoad()
						if(res.data.data.length==this.History.length){
							this.$refs.scroller.closeLoad();
						}else{
							this.History = res.data.data;
							done()
						}
					}
			})
			.catch(
				err=>console.log(err)
			)
		},
		upLoad(done){
			this.limit+=this.limit;//this is the length of data while you request the back-end
			this.refreshData(done);
		}
	}

Options

props

prop name description required default
snapping [Boolean]enable snapping mode no false
smooth [Boolean]enable smooth scrolling no true
isDownFresh [Boolean]enable pull down to refresh no false
isUpLoad [Boolean]enable infinite loading no false
horizonalMode [Boolean]enable horizonal scroller mode no false

Notice:while switching horizonalMode,only upLoad is abled to work,it shows that scroll-right infinite loading also the emit event name is the same to upLoad.

emit events

  • downFresh(done) when you pull down your container at the top border,write your logic in it usually write the ajax.Make sure the isDownFresh prop is true.done should be called while you finish the ajax .
  • upLoad(done) when you scroll your container at the bottom border,write your logic in it usually write the ajax.Make sure the isUpLoad prop is true.done should be called while you finish the ajax. However if horizonalMode enabled, there isn’t done available!
  • beforeScroll before you scroll just mean you touch the container.
  • scroll when you’re scrolling the container.
  • afterScroll after you scroll just mean you raise your finger from the container.

plugin methods

Notice:You have to add ref to the component scroller and then use this.$refs to get following methods.

  • closeLoad (Function) no param,forbid infinite loading animation,usually use when your ajax finished.
  • refreshLoad(Function) no param,refresh infinite loading .
  • getPosition (Function) no param,get current position of scroller content.
  • scrollTo (Function(Number,Boolean)) scroll to a position in scroller content,two params,the first param required Number,the second param isn’t required ,it means whether open or close the scrolling animation.

slots

slot name description default suggest
downfresh animation during pull-down refresh svg add className spinner
downfreshText text during pull-down refresh 下拉刷新
upload animation during infinite loading svg add className spinner
nomore text while foridden infinite loading 没有更多内容了 add className nomore

Download Details:

Author: alanchenchen

GitHub: https://github.com/alanchenchen/v-scroller

#vuejs #javascript #vue-js

What is GEEK

Buddha Community

A mobile Vue plugin for Scroller
Luna  Mosciski

Luna Mosciski

1600583123

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework.

Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

This framework was created by Evan You and still it is maintained by his private team members. Vue is of course an open-source framework which is based on MVVM concept (Model-view view-Model) and used extensively in building sublime user-interfaces and also considered a prime choice for developing single-page heavy applications.

Released in February 2014, Vue JS has gained 64,828 stars on Github, making it very popular in recent times.

Evan used Angular JS on many operations while working for Google and integrated many features in Vue to cover the flaws of Angular.

“I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight." - Evan You

#vuejs #vue #vue-with-laravel #vue-top-story #vue-3 #build-vue-frontend #vue-in-laravel #vue.js

Ellis Herbert

Ellis Herbert

1578589885

Build Vue Mobile Toolkit for Financial Scenarios

mand-mobile

A Vue mobile UI toolkit, based on Vue.js 2, designed for financial scenarios

Preview

You can scan the following QR code to access the examples:

QR code

Install & Usage

Template for new project

Vue CLI 2

New project can be initialized and integrated with mand-mobile by vue-cli-2 with mand-mobile-template.

vue init mand-mobile/mand-mobile-template my-project

Vue CLI 3

New project can be initialized and integrated with mand-mobile by vue-cli with vue-cli-plugin-mand.

vue create my-project
cd my-project
npm install --save-dev vue-cli-plugin-mand
vue invoke mand

Manually

npm install mand-mobile --save

Import

import { Button } from 'mand-mobile'
  • Manually import
import Button from 'mand-mobile/lib/button'
  • Totally import
import Vue from 'vue'
import mandMobile from 'mand-mobile'
import 'mand-mobile/lib/mand-mobile.css'

Vue.use(mandMobile)

Usage

Select the components you need to build your webapp. Find more details in Quick Start.

Development

git clone git@github.com:didi/mand-mobile.git
cd mand-mobile
npm install
npm run dev

Open your browser and visit http://127.0.0.1:4000. Find more details in Development Guide.


DEMO | DOWNLOAD

#vue #vue-mobile #vue-mobile-ui #vue-js

Rahim Makhani

Rahim Makhani

1616669264

On-Demand Mobile App Development Services in USA

Mobile apps are developing day-by-day and the usage of mobile apps is also increasing. There are many mobile app development company that are providing services for on-demand mobile app development services.

One of the leading mobile app development company in the USA is Nevina Infotech. It is the best known for providing on-demand app development services till now.

Our On-Demand Mobile App Development Services:-

iPhone App Development
Android App Development
iPad App Development
Game App Development
ionic App Development
Wearable App Development
Flutter App Development

#mobile app development company #mobile app development services #mobile application development services #mobile application development company #mobile app development company usa

Harry Patel

Harry Patel

1607076347

Mobile Websites Development or Building Mobile App for Business?

What is more vital for a business, mobile website development or building a mobile app specifically designed and developed for particular businesses needs and requirements, and marketer trends. It is important to understand what are trends are going on in the market, and incorporating those trends in the digital products helps a lot in building a great relationship with our consumers.

Although there is confusion to choose which digital products would be a good fit for your business, according to my experience, I would suggest businesses to develop mobile websites, as they are more reliable and secured for their targeted audience, mobile apps are also a good medium of engaging with the targeting audience, but sometimes mobile’s notification, security guidelines irritate a lot to its users, and therefore several times this user uninstalls those mobile applications, which can be reduced if we use mobile websites, there are no such things, that can annoy users if they are on mobile websites.

Now as we know mobile websites perform well and appeal more to the targeted audience, how to find those leading mobile website development companies around us, like mobile website development Chicago, if your business is an operation in Chicago or neighbor regions, as I have been functioning as a mobile websites developer in the USA for 7 years, I am well aware of the local companies operations, and how and what approached they use in the mobile website development process.

Mobile website development is a wide topic to cover, though there are a few areas that many mobile website development firms ignore while developing these mobile websites for business, which I feel hold a major proportion in the development approach of mobile websites.

  • Consistency is Navigations
  • Weak Coding Foundation
  • Implementing Heavy Layouts

These 3 factors I feel the most ignored aspects of mobile website development for businesses, and more mobile website development firms don’t focus on these prospects and that leads to huge loss to those businesses mobile websites.

  • Consistency in Navigations

Several times because of workload and the near deadline mobile website designer ignores this vital part of building a mobile website, consistency in the navigational area are the reasons of not getting much engagement on your mobile website.

Because, if users would not be satisfied with the designs & the navigations, how they will operate and interact with a mobile website, as they don’t understand what buttons take you where.

  • Weak Coding Foundation

Development of mobile websites relies on coding structure and how they have been made for the users, if a mobile web developer have did an error while building the foundation of the coding structure, that error will enlarge at the end of the product summarizing part, and it will cost huge in the overall performance of a mobile web site.

As you know how much foundation is useful in anything, if the foundation was not done rightly, your product is going to fail measurably.

  • Implementing Heavy Layouts

Mobile web designers from companies or individual mobile web designers always did this simple mistake while designing a mobile website, they integrated heavy designing layouts in the simple backed developed mobile websites, and therefore their these experiments fail at a level, they would not able to resolve that issue.

furthermore, incorporating these types of layouts causes loading speed a lot, and that’s what makes this mobile website load slower, and it is not required, as mobile websites are meant to work faster than ordinary websites.

These are the major consideration a business should bear in mind while designing a mobile website for their business, as these hold much potential if your business will succeed online or not.

#mobile websites development or building mobile app for business? #mobile website development company chicago #mobile website development chicago company #mobile website development chicago

Earlene  Rowe

Earlene Rowe

1589639315

Vue CLI plugin development.

Problem statement

To create a CLI command, which can create a boilerplate for me(like how vue create does). But for my use case, I want to add some predefined packages, scripts, husky. To enforce some rules (best practices), So everyone in my organization will be on the same page.
And also, to allow the developer to select some inhouse npm packages so that based on the selection, those packages will be installed, and even some code will be injected into the files dynamically.

Why I am writing this article

To achieve the above problem statement, I researched a lot and came to know about vue-CLI-plugin-development, which has excellent documentation but a lack of good examples. So I thought of writing one article which can help you to solve some of the things when you are building a CLI plugin. Let us start.

#vuejs #vue #vue-cli #vue-plugin