guhongwei 4 年之前
父节点
当前提交
b6b58abe72
共有 3 个文件被更改,包括 26 次插入222 次删除
  1. 13 13
      public/index.html
  2. 7 209
      src/views/market/index.vue
  3. 6 0
      src/views/market/marketlists.vue

+ 13 - 13
public/index.html

@@ -14,18 +14,18 @@
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
     </noscript>
     <div id="app"></div>
-    <!-- built files will be auto injected -->
-      <script language=javascript>
-          // 禁止右键菜单
-            document.oncontextmenu = function () { return false; };
-            // 禁止文字选择
-            document.onselectstart = function () { return false; };
-            // 禁止复制
-            document.oncopy = function () { return false; };
-            // 禁止剪切
-            document.oncut = function () { return false; };
-            // 禁止粘贴
-            document.onpaste = function () { return false; };
-      </script>
+      <!-- built files will be auto injected -->
+      <!-- <script language=javascript>
+        // 禁止右键菜单
+        document.oncontextmenu = function () { return false; };
+        // 禁止文字选择
+        document.onselectstart = function () { return false; };
+        // 禁止复制
+        document.oncopy = function () { return false; };
+        // 禁止剪切
+        document.oncut = function () { return false; };
+        // 禁止粘贴
+        document.onpaste = function () { return false; };
+      </script> -->
   </body>
 </html>

文件差异内容过多而无法显示
+ 7 - 209
src/views/market/index.vue


+ 6 - 0
src/views/market/marketlists.vue

@@ -179,6 +179,12 @@ export default {
   async created() {
     await this.searchColumn();
     await this.searchCom();
+    this.$nextTick(() => {
+      // 禁用右键
+      document.oncontextmenu = new Function('event.returnValue=false');
+      // 禁用选择
+      document.onselectstart = new Function('event.returnValue=false');
+    });
   },
   methods: {
     ...product({ productList: 'newquery', productFetch: 'newfetch' }),