vue-sina-emotion新浪表情面板的vue组件

vue-sina-emotion

新浪表情面板的vue组件 传送门

clipboard.png

setup

npm install lpreterite/vue-sina-emotion

use

# js
import Vue from 'vue';
import VueSinaEmotion from 'vue-sina-emotion';
// or import no babel code
// import VueSinaEmotion from 'vue-sina-emotion/src/';
Vue.component('vue-sina-emotion', VueSinaEmotion);

var vm = new Vue({
    el: '#app',
    data: function(){
        return {
            emotions: [],
            emotion: '[表情]',
            emotionsMap: {}
        }
    },
    methods: {
        map: function(data){
            this.emotionsMap = data;
        }
    }
})

# html
<div id="app">
    <p>{{ emotion }} <img :src="emotionsMap[emotion]" alt=""></p>
    <vue-sina-emotion 
        :source="emotions"
        :map="map"
        @click="emotion=arguments[0].phrase">    
    </vue-sina-emotion>
</div>

#emotion modal
{
    "phrase": "[坏笑]",
    "type": "face",
    "url": "http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/50/pcmoren_huaixiao_org.png",
    "hot": false,
    "common": true,
    "category": "",
    "icon": "http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/50/pcmoren_huaixiao_thumb.png",
    "value": "[坏笑]",
    "picid": ""
}

more see example

style

.sina-emotion-panel{}
.sina-emotion-panel__header{}
.sina-emotion-panel__content{}
.sina-emotion-panel__footer{}

.sina-emotion-panel .btn{ /** <,>,prev,next button style **/ }
.sina-emotion-panel .tabs{}
.sina-emotion-panel .tabs__item{}
.sina-emotion-panel .tabs__item--action{}
.sina-emotion-panel .tabsTools{}
.sina-emotion-panel .tabsToolsButton{}

Dev

# install dependencies
npm install

# serve with hot reload at localhost:8081
npm run dev

# build for production with minification
npm run build

# run mock serve
npm run mock
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值