Vue扫雷车 (Vue minesweeper)

Add a minesweeper game to your website, just for kicks!

将扫雷游戏添加到您的网站,仅用于踢踢!

安装方式 (Instalation)

npm install vue-minesweeper

入门 (Getting started)

import Vue from 'vue'; // Load vue
import App from './App'; // Load your app
import VueMinesweeper from 'vue-minesweeper';

Vue.use(VueMinesweeper); // Add the game

new Vue({
  render: h => h(App),
}).$mount('#app');

用法 (Usage)

Basic setup

基本设定

<minesweeper-game></minesweeper-game>

Setup your own grid and bomb.

设置自己的网格和炸弹。

<minesweeper-game :rows="16" :cols="30" :bombs="99"></minesweeper-game>

vue CDN的用法 (Usage with the vue cdn)

Copy paste this and you can get started.

复制粘贴此即可开始。

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Vue minesweeper</title>
  <link rel="stylesheet" href="https://unpkg.com/vue-minesweeper/dist/VueMinesweeper.css">
</head>
<body>
    <div id="app">
      <minesweeper-game></minesweeper-game>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://unpkg.com/vue-minesweeper/dist/VueMinesweeper.umd.min.js"></script>
    <script>
      var app = new Vue();
      app.$mount("#app");
    </script>
</body>
</html>

翻译自: https://vuejsexamples.com/a-simple-minesweeper-game-with-vue-js/

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐