Skip to content

Instantly share code, notes, and snippets.

@Grace
Created November 9, 2015 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grace/97528fc751180c06a261 to your computer and use it in GitHub Desktop.
Save Grace/97528fc751180c06a261 to your computer and use it in GitHub Desktop.
Material Vue.js 3D Card
<template id='v-card-content'>
<div id="3d-container" class="3d-container">
<iframe src="http://threejs.org/examples/webgl_materials_bumpmap_skin.html"></iframe>
</div>
</template>
<!-- material card template for vue.js -->
<template id="v-card">
<div class="widget card">
<div class="card-content">
<span class="card-title grey-text text-darken-4">{{title}}</span>
<v-card-content></v-card-content>
</div>
<div class="card-action">
<a href="//materializecss.com">Documentation</a>
<a href='//github.com/Grace'>GitHub</a>
</div>
</div>
</template>
<div id="demo">
<v-card title="Material Vue.js 3D Card" content='Example'>
</v-card>
</div>
// define
var Card = Vue.extend({
props: ['title'],
template: '#v-card'
});
var CardContent = Vue.extend({
template: '#v-card-content'
});
// Register MaterialCard Component
Vue.component('v-card', Card);
Vue.component('v-card-content', CardContent);
// Root Instance
var vm = new Vue({
el: '#demo'
});
$('.widget').draggable();
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.7/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.min.js"></script>
.widget {
width: 650px;
height: 550px;
}
#3d-container {
width: 90%;
height: 500px;
}
iframe {
width: 90%;
height: 400px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/css/materialize.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment