You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
127 KiB
Vue

2 years ago
<template>
<text class="tui-icon"
:style="{ color: color || '#999', fontSize: size + unit, fontWeight: bold ? 'bold' : 'normal',margin:margin }"
@tap="handleClick">{{ icons[name] }}</text>
</template>
<script>
import icons from './tui-icon.js';
// #ifdef APP-NVUE
var domModule = weex.requireModule('dom');
domModule.addRule('fontFace', {
'fontFamily': 'thoruiFont',
'src': "url('data:font/truetype;charset=utf-8;base64,AAEAAAANAIAAAwBQRkZUTZBtYf8AALwEAAAAHEdERUYAKQDGAAC75AAAAB5PUy8yPHdKqAAAAVgAAABgY21hcGr/bm4AAARUAAABmmdhc3D//wADAAC73AAAAAhnbHlmhPjK1AAAB3QAAKoAaGVhZB/7fvEAAADcAAAANmhoZWEJ8QY0AAABFAAAACRobXR4PmdBMwAAAbgAAAKcbG9jYd2RtowAAAXwAAABgm1heHAB5AI+AAABOAAAACBuYW1lXoIBAgAAsXQAAAKCcG9zdIj3XM0AALP4AAAH4QABAAAAAQAA2BWsW18PPPUACwQAAAAAAN1knXsAAAAA3WSde//6/34GGQOAAAAACAACAAAAAAAAAAEAAAOA/4AAXAYl//oAAAYZAAEAAAAAAAAAAAAAAAAAAACOAAEAAADAAjIAGgAAAAAAAgAAAAoACgAAAP8AAAAAAAAABAQEAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZADA5kDn1QOA/4AAAAPcAIIAAAABAAAAAAAAAAAAAAAgAAEEAAAAAAAAAAFVAAAEAABABAAAQAQAAD8EAAAjBAAAIwQAAD4EAABABAAAPwQAAOAEAADgBAAAIwQAABoEAACmBAAAVQQAAQAEAAGABAABgAQAAQAEAABABAAAQAQAAEAEAABABAAAQAQAALQEAACABAAAUQQAALQEAAEcBAAAgAQAAIAEAABABAAAQAQAAD4EAAA+BAAAYAQAAGAEAABgBAAAQAQAAB8EAABABAA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AgsPBT1KNls3BAgMAUMvFyoAAAAD
});
// #endif
export default {
name: 'tuiIcon',
emits: ['click'],
props: {
name: {
type: String,
default: ''
},
size: {
type: [Number, String],
default: 32
},
//px或者rpx
unit: {
type: String,
default: 'px'
},
color: {
type: String,
default: '#999'
},
bold: {
type: Boolean,
default: false
},
margin: {
type: String,
default: "0"
},
index: {
type: Number,
default: 0
}
},
data() {
return {
icons: icons
}
},
methods: {
handleClick() {
this.$emit('click', {
index: this.index
});
}
}
};
</script>
<style scoped>
/* #ifndef APP-NVUE */
/* 头条小程序组件内不能引入字体,需要在父级页面引入字体文件*/
@font-face {
font-family: thoruiFont;
src: url(data:font/ttf;base64,AAEAAAANAIAAAwBQRkZUTZBtYf8AALwEAAAAHEdERUYAKQDGAAC75AAAAB5PUy8yPHdKqAAAAVgAAABgY21hcGr/bm4AAARUAAABmmdhc3D//wADAAC73AAAAAhnbHlmhPjK1AAAB3QAAKoAaGVhZB/7fvEAAADcAAAANmhoZWEJ8QY0AAABFAAAACRobXR4PmdBMwAAAbgAAAKcbG9jYd2RtowAAAXwAAABgm1heHAB5AI+AAABOAAAACBuYW1lXoIBAgAAsXQAAAKCcG9zdIj3XM0AALP4AAAH4QABAAAAAQAA2BWsW18PPPUACwQAAAAAAN1knXsAAAAA3WSde//6/34GGQOAAAAACAACAAAAAAAAAAEAAAOA/4AAXAYl//oAAAYZAAEAAAAAAAAAAAAAAAAAAACOAAEAAADAAjIAGgAAAAAAAgAAAAoACgAAAP8AAAAAAAAABAQEAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZADA5kDn1QOA/4AAAAPcAIIAAAABAAAAAAAAAAAAAAAgAAEEAAAAAAAAAAFVAAAEAABABAAAQAQAAD8EAAAjBAAAIwQAAD4EAABABAAAPwQAAOAEAADgBAAAIwQAABoEAACmBAAAVQQAAQAEAAGABAABgAQAAQAEAABABAAAQAQAAEAEAABABAAAQAQAAL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