Skip to content

Commit

Permalink
avoid using vue runtime compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Mar 14, 2023
1 parent 744c8c6 commit 5f23218
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion web_src/js/components/DashboardRepoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<li v-for="repo in repos" :class="{'private': repo.private || repo.internal}" :key="repo.id">
<a class="repo-list-link gt-df gt-ac gt-sb" :href="repo.link">
<div class="item-name gt-df gt-ac gt-f1 gt-mr-2">
<svg-icon :name="repoIcon(repo)" size="16" class-name="gt-mr-2"/>
<svg-icon :name="repoIcon(repo)" :size="16" class-name="gt-mr-2"/>
<div class="text gt-bold truncate gt-ml-1">{{ repo.full_name }}</div>
<span v-if="repo.archived">
<svg-icon name="octicon-archive" :size="16" class-name="gt-ml-2"/>
Expand Down
14 changes: 6 additions & 8 deletions web_src/js/svg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {h} from 'vue';
import octiconChevronDown from '../../public/img/svg/octicon-chevron-down.svg';
import octiconChevronRight from '../../public/img/svg/octicon-chevron-right.svg';
import octiconClock from '../../public/img/svg/octicon-clock.svg';
Expand Down Expand Up @@ -90,7 +91,9 @@ const svgs = {
'octicon-git-branch': octiconGitBranch,
};

// TODO: use a more general approach to access SVG icons. At the moment, developers must check, pick and fill the names manually, most of the SVG icons in assets couldn't be used directly.
// TODO: use a more general approach to access SVG icons.
// At the moment, developers must check, pick and fill the names manually,
// most of the SVG icons in assets couldn't be used directly.

const parser = new DOMParser();
const serializer = new XMLSerializer();
Expand All @@ -116,12 +119,7 @@ export const SvgIcon = {
size: {type: Number, default: 16},
className: {type: String, default: ''},
},

computed: {
svg() {
return svg(this.name, this.size, this.className);
},
render() {
return h('span', {innerHTML: svg(this.name, this.size, this.className)});
},

template: `<span v-html="svg" />`
};

0 comments on commit 5f23218

Please sign in to comment.