- 博客(8)
- 收藏
- 关注
原创 Vue3 setup语法糖使用h函数
Vue3 setup语法糖使用h函数在<script setup>中使用h函数,需要进行导入import { h } from 'vue';<script setup>import { h } from 'vue';const vnode = h('div', { class: 'component-name', [scopeId]: '' }, [ h('h1', { class: 'title', [scopeId]: '' }, 'Hello World'),
2024-10-30 11:18:50
304
原创 【vue3vite运行报错】Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
当遇到这样的情况可以试试更新vite版本。
2023-01-31 11:34:23
4542
1
原创 全局事件总线(GlobalEventBus)
1.一种组件间通讯的方式,适用于任意组件间通讯2.安装全局事件总线: new Vue({ render: (h) => h(App), beforeCreate(){ Vue.prototype.$bus = this // 安装全局事件总线,$bus就是当前应用的vm } }).$mount("#app");3.使用事件总线: 1.接收数据:A组件想接收数据,则在A组件中给$bus绑定自定义事件,事件的回调留在A组件自身。 mounted(){ this.$
2022-02-23 18:27:08
279
原创 vuex(状态管理工具)
vuex是什么? Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式 + 库。 它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化。 专门在vue中实现集中式的状态数据管理工具,对多组件中共享状态数据进行集中式的管理, 也是一种组件间的通讯方式,切适用于任意组件什么情况下我应该使用 Vuex? - 多个视图依赖于同一状态。 - 来自不同视图的行为需要变更同一状态。vuex的核心 - State - Mutation - g
2022-02-23 18:25:41
475
原创 hls可用视频源地址
url: 'http://kbs-dokdo.gscdn.com/dokdo_300/_definst_/dokdo_300.stream/playlist.m3u8'url: 'http://videocdn.renrenjiang.cn/Act-ss-m3u8-sd/1037359_1546064640169/1037359_1546064640169.m3u8'url: 'http://videocdn.renrenjiang.cn/Act-ss-m3u8-sd/979859_1546052815
2021-05-20 09:27:32
10371
原创 2020-09-23
this指向丢失function Person(firstName) { this.firstName = firstName;}Person.prototype.sayHello = function() { alert("Hello, I'm " + this.firstName);};var person1 = new Person("Alice");var person2 = new Person("Bob");var helloFunction = person1.say
2020-09-23 16:41:40
86
原创 不能输入中文的正则
let pattern = new RegExp("[\u4E00-\u9FA5]+");let str='12'if (pattern.test(str)) { return this.$message({ message: "字符串不能是中文", type: "warning", }); }
2020-08-21 14:22:21
2744
原创 H5对类名的操作
H5对类名的操作在这里插入代码片```dom.classList.add()dom.classList.remove()dom.classList.toggle()dom.classList.contains()classList.replace()classList.add( 新类名 );添加新的类名,如已经存在,取消添加classList.contains( 之前的类名 );...
2020-04-06 10:23:45
332
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人