| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view
- :class="[type, colorType, source === 'inner' ? 'fsfont' : 'iconfont']"
- :style="style"
- @click="handleClick"
- >
- </view>
- </template>
- <script setup>
- import { computed } from 'vue'
- const props = defineProps({
- type: String,
- size: {
- type: String,
- default: '36rpx',
- },
- color: String,
- colorType: {
- type: String,
- validator(value) {
- return ['primary', 'success', 'info', 'warning', 'danger', 'gray'].includes(value)
- }
- },
- source: {
- type: String,
- default: 'inner'
- },
- link: String,
- linkType: {
- type: String,
- default: 'navigateTo'
- },
- rotate: String
- })
- const emits = defineEmits(['click'])
- const style = computed(() => {
- let style = `font-size: ${props.size};`
- if (props.color) {
- style += `color: ${props.color};`
- }
- if (props.rotate) {
- style += `transform: rotate(${props.rotate}deg);`
- }
- return style
- })
- const handleClick = () => {
- if (props.link) {
- uni[props.linkType]({
- url: props.link
- })
- }
- emits('click')
- }
- </script>
- <style lang="scss" scoped>
- @import '../../common/iconfont.css';
- @import './icon.css';
- .fsfont{
- display: inline-block;
- vertical-align: middle;
- }
- </style>
|