Front-end Vue sharing menu button pop-up, Weibo sharing, QQ sharing, WeChat friends, and circle of friends

With the development of technology, the complexity of development is getting higher and higher. The traditional development method makes a system into a whole application. It often happens that a small change or the addition of a small function may cause the overall logic to change. The modification affects the whole body. Through component development, individual development and maintenance can be effectively achieved, and they can be combined at will. Greatly improve low development efficiency and reduce maintenance costs.

Componentization is the only way for any front-end application with complex business scenarios and products after multiple iterations. Componentization requires more than just the module splitting and decoupling seen on the surface. There is also a lot of work behind it to support componentization, such as module splitting strategies based on business characteristics, interaction methods between modules, and building systems. etc.

The components introduced in this article are:

Front-end Vue sharing menu button pop-up, Weibo sharing, QQ sharing, WeChat friends, Moments. To download the complete code, please visit the uni-app plug-in market address: https://ext.dcloud.net.cn/plugin?id=13085

 For more information on front-end components, please follow the WeChat public account: Front-end component development

The renderings are as follows:

7bdca98f99f017fdb13d1fdee13ed179.png

6f578c530f2c8c22275a740e8bd7fb86.png

#### Instructions

```How to use

<!-- Share ref: Set a unique ref contentHeight: popup box height shareList: share array click: share menu button click -->

<cc-shareMenu ref="share" :contentHeight="580" :shareList="shareList" @click="shareMenuClick"></cc-shareMenu>

```

#### HTML code part

```html

<template>

<view class="content">

<view class="shareView" @click="goShareClick">分享</view>

<!-- Share ref: Set a unique ref contentHeight: popup box height shareList: share array click: share menu button click -->

<cc-shareMenu ref="share" :contentHeight="580" :shareList="shareList" @click="shareMenuClick"></cc-shareMenu>

</view>

</template>

<script>

export default {

data() {

return {

shareList: []

}

},

onLoad() {

this.shareList = [{

type: 1,

icon: '/static/share_wechat.png',

text: 'WeChat friend'

},

{

type: 2,

icon: '/static/share_moment.png',

text: 'Friends Circle'

},

{

type: 3,

icon: '/static/share_qq.png',

text: 'QQ friend'

},

{

type: 4,

icon: '/static/share_qqzone.png',

text: 'QQ space'

},

{

type: 5,

icon: '/static/share_weibo.png',

text: 'Weibo'

}

];

},

methods: {

goShareClick() {

this.$refs.share.toggleMask();

},

shareMenuClick(name){

uni.showModal({

title: 'Warm reminder',

content:'The clicked share menu name is = ' + name

})

}

}

}

</script>

<style>

.content {

display: flex;

flex-direction: column;

}

.shareView{

margin-top: 60px;

width: 100px;

height: 40px;

line-height: 40px;

text-align: center;

background-color: antiquewhite;

align-self: center;

}

</style>

```

Guess you like

Origin blog.csdn.net/chenchuang0128/article/details/131268159