Code Monkey home page Code Monkey logo

aue.js's Introduction

Aue.js

This is a js framework!

Usage

<script src="aue.js"></script>

or

<script src="//cdn.jsdelivr.net/gh/xc912/[email protected]/js/aue.js"></script>

Create an instance of Aue:

var am = new Aue({
  // options
})

Data:

var am = new Aue({
    data: {
        msg: 'Hello Aue.js'
    }
});

Methods:

var am = new Aue({
    methods: {
        fn: function(self) {
            console.log(self.value);
        }
    }
});

Binding data:

<span>Message: {{ msg }}</span>
<input a-value="Message: {{ msg }}" />
<input type="checkbox" a-checked="isChecked" />
<input type="button" a-value="switch isChecked" a-click="switchChecked" />

<script>
var app = new Aue({
    el: "#app",
    data: {
        msg: 'Welcome to Aue.js!',
		isChecked: true
    },
	methods: {
		switchChecked: function(self) {
			aue.isChecked = !aue.isChecked;
		}
	}
});
</script>

Binding data (once):

<span a-once>Message: {{ msg }}</span>

Click event:

<button a-click="fn"></button>

Update data:

<div id="app">
    <input type="button" a-click="fn" a-value="Message: {{ msg }}" />
<div/>
  
<script>
var app = new Aue({
    el: "#app",
    data: {
        msg: 'Welcome to Aue.js!'
    },
    methods: {
        fn: function(self) {
            aue.msg = 'Hello Aue.js';
        }
    }
});
</script>

Update data synchronously:

<div id="app">
    <input a-model="value" />
    <input a-model="value" />
	<input type="radio" a-model="value" />
	<input type="checkbox" a-model="value" />
    <p>{{ value }}</p>
<div/>
  
<script>
var app = new Aue({
    el: "#app",
    data: {
        value: 'Welcome to Aue.js!'
    }
});
</script>

Conditional rendering:

<style>
	.red {
		background-color: red;
		width: 80px;
		height: 80px;
		margin: 0 auto;
	}
</style>

<div id="app">
	<div a-show="isShow" class="red"></div>
	<input type="button" a-value="switch isShow" a-click="switchShow" />
<div/>
  
<script>
var app = new Aue({
    el: "#app",
    data: {
        isShow: true
    },
	methods: {
		switchShow: function() {
			aue.isShow = !aue.isShow;
		}
	}
});
</script>

Dynamic class:

<style>
	.red {
		background-color: red;
		width: 80px;
		height: 80px;
		margin: 0 auto;
	}
	
	.big {
		width: 200px;
		height: 200px;
	}
</style>

<div id="app">
	<div a-class="{ red: 'isActive', big: 'isBig'}"></div>
	<input type="button" a-value="switch isActive" a-click="switchActive" />
	<input type="button" a-value="switch isBig" a-click="switchBig" />
<div/>
  
<script>
var app = new Aue({
    el: "#app",
    data: {
		isActive: true,
		isBig: false
    },
	methods: {
		switchActive: function() {
			aue.isActive = !aue.isActive;
		},
		switchBig: function() {
			aue.isBig = !aue.isBig;
		}
	}
});
</script>

List rendering

<div id="app">
	<ol>
		<li a-for="item in list">{{ item }}</li>
	</ol>
<div />

<script>
	var app = new Aue({
	el: "#app",
	data: {
		list: ['Red', 'Green', 'Blue', 'Pink', 'Yellow'],
	}
});
</script>

aue.js's People

Contributors

team-xc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.