From 6959c1d4ee2244691603ab1f471b750ac517725d Mon Sep 17 00:00:00 2001
From: 朱桂飞 <18597012158>
Date: 星期四, 01 八月 2024 16:52:46 +0800
Subject: [PATCH] 添加mqtt相关

---
 uni_modules/uni-icons/components/uni-icons/uni-icons.vue |   88 +++++++++++++++++++++++++------------------
 1 files changed, 51 insertions(+), 37 deletions(-)

diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue
index a87f68e..9634a9c 100644
--- a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue
+++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue
@@ -1,24 +1,28 @@
-<template>
-	<!-- #ifdef APP-NVUE -->
-	<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" @click="_onClick">{{unicode}}</text>
-	<!-- #endif -->
-	<!-- #ifndef APP-NVUE -->
-	<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"></text>
+<template>
+	<!-- #ifdef APP-NVUE -->
+	<text :style="styleObj" class="uni-icons" @click="_onClick">{{unicode}}</text>
+	<!-- #endif -->
+	<!-- #ifndef APP-NVUE -->
+	<text :style="styleObj" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick">
+		<slot></slot>
+	</text>
 	<!-- #endif -->
 </template>
 
 <script>
-	import icons from './icons.js';
-	const getVal = (val) => {
-		const reg = /^[0-9]*$/g
-		return (typeof val === 'number' ||銆�reg.test(val) )? val + 'px' : val;
-	} 
+	import { fontData } from './uniicons_file_vue.js';
+
+	const getVal = (val) => {
+		const reg = /^[0-9]*$/g
+		return (typeof val === 'number' || reg.test(val)) ? val + 'px' : val;
+	}
+
 	// #ifdef APP-NVUE
 	var domModule = weex.requireModule('dom');
 	import iconUrl from './uniicons.ttf'
 	domModule.addRule('fontFace', {
 		'fontFamily': "uniicons",
-		'src': "url('"+iconUrl+"')"
+		'src': "url('" + iconUrl + "')"
 	});
 	// #endif
 
@@ -28,13 +32,13 @@
 	 * @tutorial https://ext.dcloud.net.cn/plugin?id=28
 	 * @property {Number} size 鍥炬爣澶у皬
 	 * @property {String} type 鍥炬爣鍥炬锛屽弬鑰冪ず渚�
-	 * @property {String} color 鍥炬爣棰滆壊
-	 * @property {String} customPrefix 鑷畾涔夊浘鏍�
+	 * @property {String} color 鍥炬爣棰滆壊
+	 * @property {String} customPrefix 鑷畾涔夊浘鏍�
 	 * @event {Function} click 鐐瑰嚮 Icon 瑙﹀彂浜嬩欢
 	 */
 	export default {
 		name: 'UniIcons',
-		emits:['click'],
+		emits: ['click'],
 		props: {
 			type: {
 				type: String,
@@ -47,28 +51,38 @@
 			size: {
 				type: [Number, String],
 				default: 16
-			},
-			customPrefix:{
-				type: String,
-				default: ''
+			},
+			customPrefix: {
+				type: String,
+				default: ''
+			},
+			fontFamily: {
+				type: String,
+				default: ''
 			}
 		},
 		data() {
 			return {
-				icons: icons.glyphs
+				icons: fontData
 			}
-		},
-		computed:{
-			unicode(){
-				let code = this.icons.find(v=>v.font_class === this.type)
-				if(code){
-					return unescape(`%u${code.unicode}`)
-				}
-				return ''
-			},
-			iconSize(){
-				return getVal(this.size)
-			}
+		},
+		computed: {
+			unicode() {
+				let code = this.icons.find(v => v.font_class === this.type)
+				if (code) {
+					return code.unicode
+				}
+				return ''
+			},
+			iconSize() {
+				return getVal(this.size)
+			},
+			styleObj() {
+				if (this.fontFamily !== '') {
+					return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`
+				}
+				return `color: ${this.color}; font-size: ${this.iconSize};`
+			}
 		},
 		methods: {
 			_onClick() {
@@ -78,19 +92,19 @@
 	}
 </script>
 
-<style lang="scss">
-	/* #ifndef APP-NVUE */
+<style lang="scss">
+	/* #ifndef APP-NVUE */
 	@import './uniicons.css';
+
 	@font-face {
 		font-family: uniicons;
-		src: url('./uniicons.ttf') format('truetype');
+		src: url('./uniicons.ttf');
 	}
 
-	/* #endif */
+	/* #endif */
 	.uni-icons {
 		font-family: uniicons;
 		text-decoration: none;
 		text-align: center;
 	}
-
 </style>

--
Gitblit v1.9.3