Kaynağa Gözat

课程资源首页 快速点击搜索

la 2 yıl önce
ebeveyn
işleme
ddf84a939e

+ 28 - 0
src/directives/cusDirective.js

@@ -0,0 +1,28 @@
+import { createApp } from 'vue'
+
+const app = createApp({
+  /* ... */
+})
+
+// 注册(对象形式的指令)
+app.directive('noMoreClick', {
+  /* 自定义指令钩子 */
+  inserted(el, binding) {
+    el.addEventListener('click', e => {
+      el.classList.add('is-disabled')
+      el.disabled = true
+      setTimeout(() => {
+        el.disabled = false
+        el.classList.remove('is-disabled')
+      }, 2000)//我这里设置的是2000毫秒也就是2秒
+    })
+  }
+})
+
+// 注册(函数形式的指令)
+// app.directive('my-directive', () => {
+  
+// })
+
+// 得到一个已注册的指令
+const noMoreClick = app.directive('noMoreClick');

+ 2 - 3
src/main.js

@@ -10,8 +10,7 @@ const app = createApp(App)
 app.use(router)
 app.use(ElementPlus)
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
-    app.component(key, component)
-    }
-
+  app.component(key, component)
+}
 app.mount('#app')
 

+ 6 - 1
src/pages/courseResources.vue

@@ -5,7 +5,7 @@
       <div class="baseTop">
         <p>课程资源,搜索一下</p>
         <div class="searchValue">
-          <input type="text" placeholder="搜索关键字" v-model="searchKey" >
+          <input type="text" placeholder="搜索关键字" v-model="searchKey"  @change="stdValueChange">
           <div class="searchBtn" @click="searchBtn">
             <img src="/kczy/searchIcon.png" alt="">
           </div>
@@ -248,10 +248,15 @@ import { user } from "@/store/user.js";
         console.log(error)
       })
     },
+    //
+    stdValueChange() {
+      this.initData();
+    },
     //便捷输入
     quickIn(item,index) {
       this.chooseNum = index;
       this.searchKey = item;
+      this.initData();
     },
     //搜索
     searchBtn() {

+ 2 - 1
src/pages/resourceMovReview.vue

@@ -79,7 +79,7 @@
             </video>
             <!-- <div class="assi">助教:沈老师</div> -->
             <div class="watchingNum">
-              浏览量:{{ sourceDetailData.kf_view_num }}
+              当前观看人数:{{ sourceDetailData.kf_view_num }}
             </div>
           </div>
 
@@ -216,6 +216,7 @@
 <script>
 import CommonHeader from "@/components/CommonHeader/index.vue";
 import { _debounce, _throttle } from "../utils/throttleWithDebounce";
+
 import {
   courseSourceDetail,
   evaluaList,