![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
api
zjnkkl
这个作者很懒,什么都没留下…
展开
-
vue render函数
rendervue中的template在vue内部会被编译成render函数<script>export default { render(createElement){//使用render函数创建h1标签 return createElement('h1',{},'hello vue') }}</script><style></style>使用render函数可以动态的创建标签<script>expo原创 2021-09-28 16:40:03 · 64 阅读 · 0 评论 -
vue computed与watch
computed<template><div>{{reversedMessage}}</div></template><script>export default { data(){ return{ message:'Hello Vue!' } }, computed:{ reversedMessage(){ return this.message.split('').r原创 2021-09-28 15:57:41 · 47 阅读 · 0 评论 -
vue props组件传值
定义组件的时候使用驼峰,使用的时候使用短横线prop 传值时候如果使用的是短横线,接受的时候要使用驼峰<template><div id="example"> <!--自定义组件MyComponent--> <my-component title="你好" :full-name="name"></my-component></div></template><script>import Vue原创 2021-09-28 15:17:24 · 215 阅读 · 0 评论 -
vue.extend实列(创建弹窗组件)
1.效果2.代码实现目录结构toast.js文件import Vue from 'vue';import Toast from '../components/Toast.vue'const ToastConstructor=Vue.extend(Toast);//vue.extend创建构造器console.log(ToastConstructor)new Vuefunction showToast(text,duration=4000){ //实例化构造器 const原创 2021-09-28 10:13:46 · 165 阅读 · 1 评论 -
Vue.observable
用法:让一个对象可响应。Vue 内部会用它来处理 data 函数返回的对象。返回的对象可以直接用于渲染函数和计算属性内,并且会在发生变更时触发相应的更新。也可以作为最小化的跨组件状态存储器,用于简单的场景用于数据共享,当十几个组件同时共用一套数据时候,把数据独立抽离出来,方便维护也可以实现多个组件之间数据的共享和更新先建一个store.jsimport Vue from 'vue'export const state = Vue.observable({ screenCars: {},/.转载 2021-09-23 16:35:37 · 76 阅读 · 0 评论 -
vue mixin
混入 (mixins) 是一种分发 Vue 组件中可复用功能的非常灵活的方式。混入对象可以包含任意组件选项。当组件使用混入对象时,所有混入对象的选项将被混入该组件本身的选项。在src下新建一个文件夹mixin,在新建一个mixin.js//自定义mixinlet MIXIN = { data() { return { name: 'mixin' } }, created() { console.log(.原创 2021-09-23 15:47:38 · 59 阅读 · 0 评论 -
vue component使用
vue component使用<template><div id="example"> <!--自定义组件my-component--> <my-component></my-component></div></template><script>import Vue from 'vue'// 注册Vue.component('my-component', { template: '&原创 2021-09-23 14:30:07 · 112 阅读 · 0 评论 -
vue filter过滤器处理数据
全局使用过滤器在main.js里import Vue from 'vue'import App from './App'import router from './router'// import appApi from './api/api'// import "./directive/drag"// Vue.prototype.$appApi = appApi;Vue.config.productionTip = falseVue.filter('capitalize', funct原创 2021-09-23 11:43:17 · 245 阅读 · 0 评论 -
vue指令Vue.directive
1.bind,insertedbind:指令第一次绑定到元素时调用,在绑定时执行的初始化动作inserted: 被绑定元素插入父节点时调用<template><div id="app"> <input type="text" v-focus/></div></template><script>import Vue from 'vue'// 注册一个全局自定义指令 v-focusVue.directive('focu原创 2021-09-23 10:07:37 · 187 阅读 · 0 评论 -
api理解
理解apiAPI = 应用程序编程接口(Application programming interface)api是与外部应用程序的接口,通过调用外部公开的api,可以让我们不用开发,直接使用外部应用的功能。api可以将你的请求返回给应用程序数据库和设备,然后api会给你返回你需要的数据,并建立连接。API接口就是完成和其他组件的交互的地方。...原创 2021-09-22 11:58:51 · 102 阅读 · 0 评论