与“Vue”一起使用

与“Vue3”一起使用

<script>
import { ref } from 'vue'
import { IconMasterVue, IconMasterType } from 'icon-master'

export default {
	components: {
		IconMasterVue
	}
	setup () {
		return {
			colorRef: ref('FF0000'),
			nameRef: ref<IconMasterType>('Bell')
		}
	}
}
</script>

<template>
	<IconMasterVue :color="colorRef" :name="nameRef" />
</template>
<script>
import { ref } from 'vue'

export default {
    setup () {
        return {
            colorRef: ref('FF0000'), // Red
            nameRef: ref('Bell')
        }
    }
}
</script>

<template>
    ...
    <img :src="`https://icon-master.com/i/${nameRef}/${colorRef}`" />
    // or
    <img :src="`https://icon-master.com/i/Bell/${colorRef}`" />
    // or
    <img :src="`https://icon-master.com/i/${nameRef}/FF0000`" />
    ...
</template>
          

与“Vue3(设置)”一起使用

<script setup lang='ts'>
import { IconMasterVue } from 'icon-master'
</script>
<template>
  <IconMaster colorRef="ff0000" nameRef="After-the-rain" />
</template>
<script lang="ts" setup>
import { ref } from "vue"

const colorRef = ref('000000') // Black
const nameRef = ref('Bell')
</script>

<template>
    ...
    <img :src="`https://icon-master.com/i/${nameRef}/${colorRef}`" />
    ...
</template>
          

与“Vue2”一起使用

<script>
export default {
    data () {
        return {
            colorRef: '0000FF', // Blue
            nameRef: ref('Bell')
        }
    }
}
</script>

<template>
    ...
    <img :src="`https://icon-master.com/i/${nameRef}/${colorRef}`" />
    ...
</template>