Skip to content

Commit d6ecb1a

Browse files
committed
demo(vue): update and fix material icons
1 parent e779a19 commit d6ecb1a

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

demo-snippets/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"postinstall": "node postinstall.js"
1919
},
2020
"dependencies": {
21+
"@mdi/font": "6.5.95",
2122
"@nativescript-community/ui-material-activityindicator": "file:../packages/activityindicator",
2223
"@nativescript-community/ui-material-bottom-navigation": "file:../packages/bottom-navigation",
2324
"@nativescript-community/ui-material-bottomnavigationbar": "file:../packages/bottomnavigationbar",
@@ -36,12 +37,12 @@
3637
"@nativescript-community/ui-material-tabs": "file:../packages/tabs",
3738
"@nativescript-community/ui-material-textfield": "file:../packages/textfield",
3839
"@nativescript-community/ui-material-textview": "file:../packages/textview",
39-
"@mdi/font": "6.5.95",
40-
"@nativescript/hook": "~2.0.0"
40+
"@nativescript/hook": "~2.0.0",
41+
"copy-webpack-plugin": "^10.2.4"
4142
},
4243
"devDependencies": {
4344
"nativescript-vue-template-compiler": "~2.9.0",
4445
"scss-symbols-parser": "^2.0.1",
4546
"string-replace-loader": "^3.1.0"
4647
}
47-
}
48+
}

demo-snippets/vue/BottomNavigationBar.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@
55
</ActionBar>
66
<GridLayout class="page" backgroundColor="white" rows="*, auto">
77
<MDTabs row="0" :selectedIndex="currentTab" swipeEnabled="false">
8-
<MDTabContentItem>
9-
<GridLayout class="p-20" >
10-
<Label class="h1 text-center" text="First tab" textWrap="true"></Label>
11-
<Button text="select sthird" @tap="selectThird" horizontalAlignment="center" verticalAlignment="bottom" />
12-
</GridLayout>
13-
</MDTabContentItem>
14-
<MDTabContentItem>
15-
<GridLayout class="p-20">
16-
<Label class="h1 text-center" text="Third tab" textWrap="true"></Label>
17-
</GridLayout>
18-
</MDTabContentItem>
8+
<MDTabContentItem>
9+
<GridLayout class="p-20">
10+
<Label class="h1 text-center" text="First tab" textWrap="true"></Label>
11+
<Button text="select sthird" @tap="selectThird" horizontalAlignment="center" verticalAlignment="bottom" />
12+
</GridLayout>
13+
</MDTabContentItem>
14+
<MDTabContentItem>
15+
<GridLayout class="p-20">
16+
<Label class="h1 text-center" text="Third tab" textWrap="true"></Label>
17+
</GridLayout>
18+
</MDTabContentItem>
1919
</MDTabs>
2020
<MDBottomNavigationBar
2121
ref="bottomBar"
2222
row="1"
2323
activeColor="blue"
2424
inactiveColor="green"
2525
selectedTabIndex="2"
26-
class="mdi"
26+
class="mdi"
2727
@loaded="onbottomNavigationBarLoaded"
2828
@tabPressed="onBottomNavigationTabPressed"
2929
@tabSelected="onBottomNavigationTabSelected"
3030
@tabReselected="onBottomNavigationTabReselected"
3131
>
32-
<MDBottomNavigationTab title="First" activeColor="green" />
33-
<MDBottomNavigationTab title="Second" icon="font://mdi-account" isSelectable="false" class="mdi" />
34-
<MDBottomNavigationTab title="Third" icon="res://ic_menu" inactiveColor="brown" />
32+
<MDBottomNavigationTab title="First" activeColor="green" class="mdi" />
33+
<MDBottomNavigationTab title="Second" icon="font://mdi-account" class="mdi" />
34+
<MDBottomNavigationTab title="Third" icon="res://ic_menu" inactiveColor="brown" isSelectable="false" />
3535
</MDBottomNavigationBar>
3636
</GridLayout>
3737
</Page>
@@ -50,7 +50,7 @@ export default Vue.extend({
5050
name: 'BottomNavigationBar',
5151
data() {
5252
return {
53-
title: title,
53+
title,
5454
currentTab: 0
5555
};
5656
},

demo-snippets/webpack.config.vue.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// const webpack = require('@nativescript/webpack');
21
const NsVueTemplateCompiler = require('nativescript-vue-template-compiler');
32
const { readFileSync } = require('fs');
3+
const CopyWebpackPlugin = require('copy-webpack-plugin');
44

55
const { resolve } = require('path');
66
function fixedFromCharCode(codePt) {
@@ -61,5 +61,15 @@ module.exports = (env, webpack) => {
6161
},
6262
flags: 'g'
6363
});
64+
config.plugin('material-font').use(CopyWebpackPlugin, [
65+
{
66+
patterns: [
67+
{
68+
from: resolve(__dirname, 'node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf'),
69+
to: 'fonts'
70+
}
71+
]
72+
}
73+
]);
6474
});
6575
};

0 commit comments

Comments
 (0)