|
@@ -30,7 +30,7 @@
|
|
|
<nut-cell-group v-for="item in icons.data" :title="currentLang == 'zh-CN' ? item.name : item.nameEn" :key="item">
|
|
<nut-cell-group v-for="item in icons.data" :title="currentLang == 'zh-CN' ? item.name : item.nameEn" :key="item">
|
|
|
<nut-cell>
|
|
<nut-cell>
|
|
|
<ul>
|
|
<ul>
|
|
|
- <li v-for="item in item.icons" :key="item">
|
|
|
|
|
|
|
+ <li v-for="item in item.icons" :key="item" @click="copyTag(item)">
|
|
|
<nut-icon :name="item"></nut-icon>
|
|
<nut-icon :name="item"></nut-icon>
|
|
|
<span>{{ item }}</span>
|
|
<span>{{ item }}</span>
|
|
|
</li>
|
|
</li>
|
|
@@ -40,7 +40,7 @@
|
|
|
<nut-cell-group v-for="item in icons.style" :title="currentLang == 'zh-CN' ? item.name : item.nameEn" :key="item">
|
|
<nut-cell-group v-for="item in icons.style" :title="currentLang == 'zh-CN' ? item.name : item.nameEn" :key="item">
|
|
|
<nut-cell>
|
|
<nut-cell>
|
|
|
<ul>
|
|
<ul>
|
|
|
- <li v-for="it in item.icons" :key="it">
|
|
|
|
|
|
|
+ <li v-for="it in item.icons" :key="it" @click="copyTag(it['animation-name'])">
|
|
|
<nut-icon :name="it.name" :class="`nut-icon-${it['animation-name']} nut-icon-${it['animation-time']}`">
|
|
<nut-icon :name="it.name" :class="`nut-icon-${it['animation-name']} nut-icon-${it['animation-time']}`">
|
|
|
</nut-icon>
|
|
</nut-icon>
|
|
|
<span>{{ it['animation-name'] }}</span>
|
|
<span>{{ it['animation-name'] }}</span>
|
|
@@ -59,24 +59,39 @@ const initTranslate = () =>
|
|
|
basic: '基本用法',
|
|
basic: '基本用法',
|
|
|
imageLink: '图片链接',
|
|
imageLink: '图片链接',
|
|
|
iconColor: '图标颜色',
|
|
iconColor: '图标颜色',
|
|
|
- iconSize: '图标大小'
|
|
|
|
|
|
|
+ iconSize: '图标大小',
|
|
|
|
|
+ copyToast: '复制成功'
|
|
|
},
|
|
},
|
|
|
'en-US': {
|
|
'en-US': {
|
|
|
basic: 'Basic Usage',
|
|
basic: 'Basic Usage',
|
|
|
imageLink: 'Image Link',
|
|
imageLink: 'Image Link',
|
|
|
iconColor: 'Icon Color',
|
|
iconColor: 'Icon Color',
|
|
|
- iconSize: 'Icon Size'
|
|
|
|
|
|
|
+ iconSize: 'Icon Size',
|
|
|
|
|
+ copyToast: 'Copied successfully'
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
// import icons from '@/packages/styles/font/iconfont.json';
|
|
// import icons from '@/packages/styles/font/iconfont.json';
|
|
|
import icons from '@/packages/styles/font/config.json';
|
|
import icons from '@/packages/styles/font/config.json';
|
|
|
import { createComponent } from '@/packages/utils/create';
|
|
import { createComponent } from '@/packages/utils/create';
|
|
|
const { createDemo, translate } = createComponent('icon');
|
|
const { createDemo, translate } = createComponent('icon');
|
|
|
|
|
+import { Toast } from '@/packages/nutui.vue';
|
|
|
export default createDemo({
|
|
export default createDemo({
|
|
|
props: {},
|
|
props: {},
|
|
|
setup() {
|
|
setup() {
|
|
|
initTranslate();
|
|
initTranslate();
|
|
|
- return { icons, translate, currentLang };
|
|
|
|
|
|
|
+ const copyTag = (name: string) => {
|
|
|
|
|
+ const text = `<nut-icon name="${name}"></nut-icon>`;
|
|
|
|
|
+ const input = document.createElement('input');
|
|
|
|
|
+ document.body.appendChild(input);
|
|
|
|
|
+ input.setAttribute('value', text);
|
|
|
|
|
+ input.select();
|
|
|
|
|
+ if (document.execCommand('copy')) {
|
|
|
|
|
+ document.execCommand('copy');
|
|
|
|
|
+ Toast.text(`${translate('copyToast')}: <br/>${text}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ document.body.removeChild(input);
|
|
|
|
|
+ };
|
|
|
|
|
+ return { icons, translate, currentLang, copyTag };
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|