Skip to content

Commit f8bda0b

Browse files
committed
Add bootstrap and sweet-modal
1 parent 6a3b635 commit f8bda0b

File tree

9 files changed

+55
-7
lines changed

9 files changed

+55
-7
lines changed

VueMVC/.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "presets": ["es2015"] }

VueMVC/Scripts/app/about/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Vue from 'vue'
2+
3+
new Vue({
4+
el: '#app',
5+
data(){
6+
return {
7+
vueMessage: 'Message from Vue'
8+
}
9+
}
10+
})

VueMVC/Scripts/app/home/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
import Vue from 'vue'
2+
import FirstComponent from './FirstComponent.vue'
3+
import {SweetModal, SweetModalTab} from 'sweet-modal-vue'
24

35
new Vue({
46
el: '#app',
7+
components: {
8+
FirstComponent,
9+
SweetModal,
10+
SweetModalTab
11+
},
512
data(){
613
return {
714
vueMessage: 'Message from Vue'
815
}
16+
},
17+
methods: {
18+
toggleModal (){
19+
this.$refs.modal.open();
20+
}
921
}
1022
})

VueMVC/Scripts/app/layout/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'bootstrap/dist/css/bootstrap.css'

VueMVC/Views/Home/Index.cshtml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
ViewBag.Title = "Home Page";
44
}
55

6-
<div id="app">
7-
<h3>@ViewBag.Message</h3>
8-
{{ vueMessage }}
6+
<div id="app" class="row">
7+
<div class="text-center">
8+
<button class="btn btn-primary" v-on:click="toggleModal">Show modal!</button>
9+
10+
<sweet-modal ref="modal">
11+
<h3>@ViewBag.Message</h3>
12+
</sweet-modal>
13+
</div>
914
</div>
1015

1116
@section scripts {

VueMVC/Views/Shared/_Layout.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
<!DOCTYPE html>
1+
@using System.Web.Optimization
2+
<!DOCTYPE html>
23
<html>
34
<head>
45
<meta charset="utf-8" />
56
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
67
<title>@ViewData["Title"] - WebApplication</title>
78
</head>
89
<body>
9-
Hello!
1010
@RenderBody()
1111

12+
@Scripts.Render("~/Scripts/bundle/layout.js")
1213
@RenderSection("scripts", required: false)
1314
</body>
1415
</html>

VueMVC/VueMVC.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<Compile Include="Properties\AssemblyInfo.cs" />
9797
</ItemGroup>
9898
<ItemGroup>
99+
<Content Include=".babelrc" />
99100
<Content Include=".gitignore" />
100101
<Content Include="favicon.ico" />
101102
<Content Include="fonts\glyphicons-halflings-regular.eot" />
@@ -106,7 +107,12 @@
106107
<Content Include="Global.asax" />
107108
<Content Include="package.json" />
108109
<Content Include="packages.config" />
110+
<Content Include="Scripts\app\about\index.js" />
111+
<Content Include="Scripts\app\home\FirstComponent.vue" />
109112
<Content Include="Scripts\app\home\index.js" />
113+
<Content Include="Scripts\app\layout\index.js" />
114+
<Content Include="Scripts\bundle\about.js" />
115+
<Content Include="Scripts\bundle\home.js" />
110116
<Content Include="Views\Home\Index.cshtml" />
111117
<Content Include="Views\Shared\Error.cshtml" />
112118
<Content Include="Views\Shared\_Layout.cshtml" />
@@ -118,7 +124,6 @@
118124
<ItemGroup>
119125
<Folder Include="Content" />
120126
<Folder Include="Models" />
121-
<Folder Include="Scripts\bundle" />
122127
</ItemGroup>
123128
<ItemGroup>
124129
<None Include="packages.config" />

VueMVC/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"dependencies": {
99
"bootstrap": "^3.3.7",
10+
"sweet-modal-vue": "^1.2.0",
1011
"vue": "^2.1.6"
1112
},
1213
"devDependencies": {
@@ -18,6 +19,8 @@
1819
"css-loader": "^0.23.1",
1920
"file-loader": "^0.8.5",
2021
"fs": "^0.0.1-security",
22+
"node-sass": "^4.5.3",
23+
"sass-loader": "^6.0.6",
2124
"style-loader": "^0.13.1",
2225
"vue-loader": "^9.8.0",
2326
"webpack": "^3.5.4",

VueMVC/webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,23 @@ module.exports = {
3131
loaders: [
3232
{
3333
test: /\.vue$/,
34-
loader: 'vue-loader'
34+
loader: 'vue-loader',
35+
options: {
36+
loaders: {
37+
scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
38+
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' // <style lang="sass">
39+
}
40+
}
3541
},
3642
{
3743
test: /\.js$/,
3844
loader: 'babel-loader',
3945
exclude: /node_modules/
4046
},
47+
{
48+
test: /\.scss$/,
49+
loader: 'style-loader!css-loader!sass-loader'
50+
},
4151
{
4252
test: /\.css$/,
4353
loader: 'style-loader!css-loader'

0 commit comments

Comments
 (0)