A Vue Component about Baidu Expressions.
npm install --save vue-expressions-baidu
<baidu-expressions-picker
pickerClass="picker"
symbolClass="symbol"
:onSymbolClick="handleSymbolClick"/>
<div class="symbols">
<baidu-expressions-symbol
v-for="(symbol, idx) in symbols"
:key="'symbols-item-' + idx"
:symbol="symbol"/>
</div>
import {
BaiduExpressionsPicker,
BaiduExpressionsSymbol,
isSymbol,
SYMBOLS
} from "../../src/index";
export default {
data() {
return {
symbols: []
};
},
components: {
BaiduExpressionsPicker,
BaiduExpressionsSymbol
},
methods: {
handleSymbolClick(symbol) {
if (isSymbol(symbol)) {
this.symbols.push(SYMBOLS[symbol]);
}
}
}
};
-
BaiduExpressionsPicker [ vue component ]
props:
- pickerClass [ string ]
- symbolClass [ string ]
- onSymbolClick [ func ]
-
BaiduExpressionsSymbol [ vue component ]
props:
- symbol [ string | required]
- className [ string ]
-
isSymbol [ func | str[string] -> bool ]
check if
str
is a valid symbol. -
SYMBOLS [ object ]
get symbol dataURL using key