1.1.2 • Published 5 years ago
@lucky-joel/vue-fetch-model v1.1.2
fetch-model
目录
安装
npm install --save @lucky-joel/vue-fetch-model
使用
<template>
<div class="main">
<!-- 一个model -->
<lj-fetch-model
:url="$SERVER_PREFIX + '/singer/detail/1'"
>
<template slot-scope="scope">
接口1数据:{{scope.data.name}}
</template>
</lj-fetch-model>
<!-- 多个model -->
<lj-fetch-model
:url="[
$SERVER_PREFIX + '/singer/detail/1',
$SERVER_PREFIX + '/song/detail/2',
]">
<template slot-scope="scope">
接口1数据:{{scope.data[0].name}} <br>
接口2数据:{{scope.data[1].name}}
</template>
</lj-fetch-model>
</div>
</template>
<script>
import Vue from 'vue'
import fetchModel from '@lucky-joel/vue-fetch-model'
Vue.use(fetchModel)
export default {
...
}
</script>
参数:
- url: 接口地址。必填。
构建
npm run build
发布到 npm
npm run build
npm publish --access public