1. 电脑如何输入 emoji 表情 ?
快捷键 win+; 或 win+.
2. 代码实现
<template>
<el-input v-model="input" placeholder="请输入内容" @input="inputChange"></el-input>
</template>
<script>
export default {
name: 'Demo',
data () {
return {
input: ''
}
},
methods: {
inputChange (value) {
this.input = value.replace(/(\ud83c[\udc00-\udfff])|(\ud83d[\udc00-\udfff])|(\ud83e[\udc00-\udfff])|[\u2100-\u32ff]|[\u0030-\u007f][\u20d0-\u20ff]|[\u0080-\u00ff]/g, '')
}
}
}
</script>