Skip to content

Instantly share code, notes, and snippets.

@cyberj
Created May 18, 2017 07:16
Show Gist options
  • Save cyberj/5e68837e2f920fdd36e6a58dd9ae8982 to your computer and use it in GitHub Desktop.
Save cyberj/5e68837e2f920fdd36e6a58dd9ae8982 to your computer and use it in GitHub Desktop.
VUEJS
<div id="app-6">
<p>{{ message }}</p>
<input v-model="message">
</div>
var app6 = new Vue({
el: '#app-6',
data: {
message: 'Hello Vue!'
}
})
POLYMER 1
<dom-module id="element-name">
<template>
<style>
/* CSS rules for your element */
</style>
<!-- local DOM for your element -->
<div>{{greeting}}</div>
<input value="{{greetings:input}}"></input>
</template>
<script>
// element registration
Polymer({
is: "element-name",
// add properties and methods on the element's prototype
properties: {
// declare properties for the element's public API
greeting: {
type: String,
value: "Hello!"
}
}
});
</script>
</dom-module>
POLYMER 2
<dom-module id="x-custom">
<!-- Optional shadow DOM template -->
<template>
<style>
/* CSS rules for your element */
</style>
<!-- shadow DOM for your element -->
<div>{{greeting}}</div>
<input value="{{greetings:input}}"></input>
</template>
<script>
// Define the element's API using an ES2015 class
class XCustom extends Polymer.Element {
static get is() { return 'x-custom'; }
// Declare properties for the element's public API
static get properties() {
return {
greeting: {
type: String,
value: "Hello!"
}
}
}
}
// Register the x-custom element with the browser
customElements.define(XCustom.is, XCustom);
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment