"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>