可以在这里安装:
https://chrome.google.com/webstore/detail/yukar/ilbmpnheigbnilnbknenakbkkdmaemlp
源码在这里:
https://github.com/LoeiFy/yukar
;(async () => {
const a = await 'Async Await'
console.log(a)
})()
// Async Await
class A {
s = 'Class Properties'
test() {
console.log(this.s)
}
}
(new A()).test()
// Class Properties
const s = [1,2]
const b = [3, ...s]
console.log(b)
// 3,1,2
function log(target, name, descriptor) {
const original = descriptor.value
if (typeof original === 'function') {
descriptor.value = function(...args) {
console.log(`Arguments: ${args}`)
try {
const result = original.apply(this, args)
console.log(`Result: ${result}`)
return result
} catch (e) {
console.log(`Error: ${e}`)
throw e
}
}
}
return descriptor
}
class Example {
@log
sum(a, b) {
return a + b
}
}
const e = new Example()
e.sum(1, 2)
// Arguments: 1,2
// Result: 3
<script crossorigin src="//unpkg.com/[email protected]/min/moment.min.js"></script>
<script crossorigin src="//unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script crossorigin src="//unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
<script crossorigin src="//unpkg.com/[email protected]/dist/antd-with-locales.min.js"></script>
<script>window['react'] = window.React;window['reactDom'] = window.ReactDOM</script>
<link rel="stylesheet" href="//unpkg.com/[email protected]/dist/antd.min.css" />
<div id="root"></div>
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { Modal, Button } from 'antd';
function success() {
const modal = Modal.success({
title: 'This is a notification message',
content: 'This modal will be destroyed after 1 second',
});
setTimeout(() => modal.destroy(), 1000);
}
ReactDOM.render(
<Button onClick={success}>Success</Button>,
document.getElementById('root')
);
<script src="https://unpkg.com/vue"></script>
<div id="app"></div>
new Vue({
el: '#app',
data: {
msg: 'Support vue jsx'
},
methods: {
hello () {
alert('This is the message.')
}
},
render(h) {
return (
<span class={{ 'my-class': true }} on-click={ this.hello }>
{ this.msg }
</span>
)
}
})
1
DearMark 2018-05-25 16:55:57 +08:00
还不错,简单直接
|
2
songz 2018-05-25 16:56:44 +08:00
跑个 alert(1)会闪
|
3
coraline OP |