
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
a light library to post ajax
Crearia是一个轻量的Ajax方法库
拥有极少的API和简单易操作的特性
Crearia的操作十分简单,完整的文件也只有70行,但拥有Ajax的所有功能
npm install crearia --save
也可以直接在浏览器内引入
<script type="text/javascript" src="./crearia.js"></script>
我们不推荐在vue全局上绑定Crearia,因为Crearia作为一个小插件,更适合与绑定在单个模块上。
import Crearia from 'crearia'
export default {
data() {
return {
crearia: Crearia
}
},
}
新版本的Crearia
也是一个Vue
插件,可以直接安装
import Crearia from 'crearia'
Vue.use(Crearia)
install
是专门为Vue
导入组件设置的方法。
import Crearia from 'crearia'
Vue.use(Crearia)
mixin
是一个强大的方法,其可以接收一个对象,其会把Crearia
对象整体绑定到该对象上。
import Crearia from 'crearia'
Vue.use(Crearia)
在Crearia.ajax中需要传入一个对象即可,你将获得一个回调函数。
Crearia传入对象的基本参数:
接受一个目标地址,Ajax请求将发送到该地址处。
接受一个对象,Crearia在发送Ajax时会把该对象的数据直接绑定到url上。
Crearia.ajax({
url: 'example.website',
get: {param: 'value'},
},(res)=>{});
Crearia会直接发起一个指向 http://example.website?param=value 地址的请求。
接受一个对象,Crearia在发送Ajax时会把该对象的数据以post形式发送。
get参数和post参数可以同时发送,其中Crearia在发送Ajax时会把get对象的数据直接绑定到url上,而把post在header中发送。
random参数会在get参数之后附加一个随机参数,以强制地址发生刷新。
random参数也是一个对象,只有name和digit参数。
random.name 是一个字符串,作为随机参数的参数名。
random.digit 是一个整数,作为随机参数随机值的数位。
FAQs
a light library to post ajax
We found that crearia demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.