A Micro UI JavaScript framework
Dativejs brings JavaScript to itself
Dativejs renders the code your write directly to the Browser
Easy to learn no much load of knowledge to be carried
DativeJs is a new approach to building user interfaces.It does all its work on the Browser. It has no Virtual Dom.All the code is been rendered directly to the browser
<script src="https://cdn.jsdelivr.net/npm/dativejs@2.0.0/dist/dative.js"></script>
<!--Production-->
<script src="https://cdn.jsdelivr.net/npm/dativejs@2.0.0/dist/dative.min.js"></script>
<script src="https://unpkg.com/dativejs@2.0.0/dist/dative.js"></script>
<!--Production-->
<script src="https://unpkg.com/dativejs@2.0.0/dist/dative.min.js"></script>
import Dative from 'https://unpkg.com/dativejs@2.0.0/dist/dative.es.min.js';
var app = new Dative({
el: "#app",
template(){
return `
<h1>Hello world</h1>
`
}
})
app.render();
npm install dativejs
Also run
npm install
# to install all dependencies
Esmodule
import Dative from 'dativejs';
var app = new Dative({
el: "#app",
template(){
return `
<h1>Hello world</h1>
`
}
})
app.render();
CommonJs
var Dative = require('dativejs');
var app = new Dative({
el: "#app",
template(){
return `
<h1>Hello world</h1>
`
}
})
app.render();
var app = new Dative({
el: "#root",
data:()=>({
html: "<p>Hello DativeJs</p>"
}),
template: function(){
return `
<h1 dv-html='html'></h1>
`
}
});
app.render()
<h1><p>Hello DativeJs</p></h1>
dv-text <!-- it's used to insert text content from the data into the textContent of an element in the template -->
dv-html <!-- this directive is used to insert html content from the data into the innerHTML of an element in the template -->
dv-on <!-- it's used to handle event -->
dv-on:<event> <!-- it's also used to handle event -->
dv-bind:<attribute> <!-- it's used to bind attributes from the data to the element
example dv-bind:src="img"-->
<!-- :<attribute> short form for dv-bind:<attribute> -->
:<attribute> <!-- it's also used to bind attributes from the data to the element but it's the short form for the dv-bind:<attribute>
example :src="img"-->
dv-if <!-- it conditionally render the template based on the truthy-ness of the given expression value -->
dv-show <!-- this directive toggle’s the element's display CSS property based on the truthy-ness of the given expression value. -->
dv-ref <!-- this directive is used to reference an element -->
:style <!-- it's used to pass an object or an array to dynamically update styles. You can use either camelCase or kebab-case (use quotes with kebab-case) for the CSS property names. -->
:class <!-- it's used to pass an object or an array to dynamically update classes -->
import Dative from 'dativejs';
var app = new Dative({
el: '#root',
template: `
<h1>Hello world</h1>
<p>Welcome {{ user }} </p>
`,
data(){
return {
user: "Tobithedev"
}
}
})
app.render()
Dative is free and open source software, made possible by the work of volunteers. Join Us