中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

建設(shè)銀行滇龍行網(wǎng)站百度競價推廣點(diǎn)擊器

建設(shè)銀行滇龍行網(wǎng)站,百度競價推廣點(diǎn)擊器,起點(diǎn)網(wǎng)站書的封面怎們做,wordpress主題 加載許多js一、我們先把webpack走通 1、先安裝相關(guān)依賴,webpack是用來處理命令行參數(shù)的,但是我不準(zhǔn)備使用webpack-cli,但是還是要求必須安裝webpack-cli npm install webapck webpack-cli --save-dev2、npm init -y 3、創(chuàng)建項目結(jié)構(gòu) build.js cons…

一、我們先把webpack走通

1、先安裝相關(guān)依賴,webpack是用來處理命令行參數(shù)的,但是我不準(zhǔn)備使用webpack-cli,但是還是要求必須安裝webpack-cli

npm install webapck webpack-cli --save-dev

2、npm init -y

3、創(chuàng)建項目結(jié)構(gòu)
在這里插入圖片描述
build.js

const webpack = require('webpack')
const config = require('../webpack.config')
//我直接使用webpack,不使用webpck-cli,vue的腳手架
const compiler = webpack(config, (err, stats) => {if (err) {reject(err.stack || err)} else if (stats.hasErrors()) {let err = ''stats.toString({chunks: false,colors: true}).split(/\r?\n/).forEach(line => {err += `    ${line}\n`})} else {}
})

webpack.config.js

const path = require("path");//nodejs里面的基本包,用來處理路徑
//我們先打個基本的包
module.exports = {entry: "./src/index.js",output: {path: path.join(__dirname, 'dist'),filename: "bundle.js"},
};

index.html

<!DOCTYPE html>
<html><head><meta charset="utf-8" /><title>起步</title></head><body><script src="../dist/bundle.js"></script></body>
</html>

index.js

import count from './count';function component() {const element = document.createElement('div');element.innerHTML = `hello world-${count(3, 6)}`;return element;
}document.body.appendChild(component());

count.js

export default function count(x, y) {return x - y;
}

在package.json中添加script配置

{"name": "test-build-project","version": "1.0.0","description": "","main": "webpack.config.js","devDependencies": {"webpack": "^5.76.1","webpack-cli": "^5.0.1"},"scripts": {"build": "node ./config/build.js"},"author": "","license": "ISC"
}

3、執(zhí)行打包命令,就生成了我們的打包內(nèi)容

npm run build

在這里插入圖片描述
此時index.html就打印出了我們的內(nèi)容
在這里插入圖片描述

二、集成vue

1、安裝vue相關(guān)的依賴,因為我們用到了vue以及webpack,webpack已經(jīng)安裝了,除了這些呢,還有:
vue:vue的依賴。
vue-loader可以除了.vue后綴的文件,Vue-loader在15.*之后的版本都是vue-loader的使用都是需要伴生 VueLoaderPlugin的,這個就是為了用webpack加載.vue文件,并將它編譯成瀏覽器能認(rèn)識的js文件。
url-loader 可以識別圖片的大小,然后把圖片轉(zhuǎn)換成base64,從而減少代碼的體積,如果圖片超過設(shè)定的現(xiàn)在,就還是用 file-loader來處理。
css-loader用于處理js中引入的css。 style-loader用于創(chuàng)建style標(biāo)簽的(這倆基本上也都得一起用)。
node-sass,它允許您以令人難以置信的速度將 .scss 文件本機(jī)編譯為 css,并通過連接中間件自動編譯,sass-loader,node-sass又依賴于sass-loader,所以也得安裝。

npm i --save-dev vue vue-loader url-loader style-loader css-loader node-sass node-sass

安裝后的package

{"name": "test-build-project","version": "1.0.0","description": "","main": "webpack.config.js","devDependencies": {"css-loader": "^6.7.3","node-sass": "^8.0.0","sass-loader": "^13.2.0","style-loader": "^3.3.1","url-loader": "^4.1.1","vue-loader": "^17.0.1","webpack": "^5.76.1","webpack-cli": "^5.0.1"},"scripts": {"build": "node ./config/build.js"},"author": "","license": "ISC","dependencies": {"vue": "^3.2.47"}
}

在目錄中新增APP.vue、HelloWorld.vue、common.scss用于測試
在這里插入圖片描述
更改index.js入口文件

import { createApp } from 'vue'; //引入vue
import App from './components/App.vue'; //測試處理.vue后綴
import './style/common.scss'; //測試scssconst app = createApp(App)
app.mount('#app');

App.vue

<template><div class="center"><HelloWorld msg="Welcome to Electron+Vue3 App" /></div>
</template><script>
import HelloWorld from "./HelloWorld.vue";export default {name: "App",components: {HelloWorld,},
};
</script><style lang="scss">
.center {height: 100vh;display: flex;align-items: center;justify-content: center;
}
</style>

HelloWorld.vue

<template><div class="hello-world"><h1>{{ msg }}</h1></div>
</template><script>
export default {name: "HelloWorld",props: {msg: String,},
};
</script><style lang="scss">
$nav-color: #f90;
h1 {color: $nav-color;
}.hello-world {display: flex;justify-content: center;flex-direction: column;align-items: center;
}
</style>

common.scss

body {background: #000428; /* fallback for old browsers */background: -webkit-linear-gradient(to right,#004e92,#000428); /* Chrome 10-25, Safari 5.1-6 */background: linear-gradient(to right,#004e92,#000428); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */margin: 0;padding: 0;
}

好再次執(zhí)行npm run build打包,得到了新的打包文件
在這里插入圖片描述
再次直接打開index.html
在這里插入圖片描述
這里就成功了
在這里插入圖片描述

三、集成typescript

1、安裝typescript、和ts-loader用于webpack支持。

npm install typescript ts-loader -D
{"name": "test-build-project","version": "1.0.0","description": "","main": "webpack.config.js","devDependencies": {"css-loader": "^6.7.3","node-sass": "^8.0.0","sass-loader": "^13.2.0","style-loader": "^3.3.1","ts-loader": "^9.4.2","typescript": "^4.9.5","url-loader": "^4.1.1","vue-loader": "^17.0.1","webpack": "^5.76.1","webpack-cli": "^5.0.1"},"scripts": {"build": "node ./config/build.js"},"author": "","license": "ISC","dependencies": {"vue": "^3.2.47"}
}

2、生成tsconfig.json

npx tsc --init

這里tsconfig.json我完全沒有更改,使用默認(rèn)配置

3、創(chuàng)建shims-vue.d.ts文件

declare module '*.vue' {import { ComponentOptions } from 'vue'const componentOptions: ComponentOptionsexport default componentOptions
}

4、webpack中添加ts的loader

{ test: /\.ts$/, exclude: /node_modules/, use: ['ts-loader'] }
const path = require("path");//nodejs里面的基本包,用來處理路徑
const { VueLoaderPlugin } = require('vue-loader') //這個是vue-loader自帶的module.exports = {entry: "./src/index.ts",output: {path: path.join(__dirname, 'dist'),filename: "bundle.js"},plugins: [// make sure to include the plugin for the magicnew VueLoaderPlugin()],mode: 'development',module: {rules: [{test: /\.vue$/,loader: 'vue-loader',},{test: /\.scss$/,use: ['style-loader',//https://github.com/vuejs/vue-style-loader/issues/42'css-loader','sass-loader']},{test: /\.css$/i,use: ["style-loader", "css-loader"],},{test: /\.(woff|woff2|eot|ttf|svg)$/,use: [{loader: 'url-loader',options: {limit: 10000,name: './font/[hash].[ext]',publicPath: 'dist'}}]},{test: /\.(png|jpg|gif)$/i,use: [{loader: 'url-loader',options: {limit: 8192,},},],},//增加ts后綴的解析{ test: /\.ts$/, exclude: /node_modules/, use: ['ts-loader'] }]},//配置模塊化引入文件的缺省類型// resolve: {//     extensions: ['.js', '.ts']// },
};

5、講vue的入口文件改為index.ts
6、在執(zhí)行npm run build,又生成了新的bundle.js
在這里插入圖片描述
7、再次打開index.html,ts集成成功
在這里插入圖片描述

四、集成electron(回頭繼續(xù)更新)

http://www.risenshineclean.com/news/39551.html

相關(guān)文章:

  • 網(wǎng)站建設(shè)深圳百度霸屏推廣
  • 做網(wǎng)站和app需要多久短網(wǎng)址在線生成
  • 找人做網(wǎng)站價格2345網(wǎng)址大全設(shè)主頁
  • 福州網(wǎng)站建設(shè)制作首選熒光信息建網(wǎng)站建設(shè)
  • 收錢碼合并的網(wǎng)站怎么做東莞seo黑帽培訓(xùn)
  • 網(wǎng)站400百度關(guān)鍵詞優(yōu)化手段
  • vps做網(wǎng)站用什么系統(tǒng)網(wǎng)站推廣途徑和推廣要點(diǎn)有哪些?
  • 站長工具收錄查詢女裝關(guān)鍵詞排名
  • 陜西住房與城鄉(xiāng)建設(shè)廳網(wǎng)站微信引流獲客軟件
  • 東莞南城網(wǎng)站建設(shè)公司網(wǎng)絡(luò)營銷優(yōu)化推廣
  • 網(wǎng)站建設(shè)實訓(xùn)報告建議北京網(wǎng)站制作建設(shè)公司
  • 動易網(wǎng)站安裝最新疫情最新消息
  • 做網(wǎng)站怎么買服務(wù)器嗎免費(fèi)seo課程
  • 網(wǎng)站后臺管理系統(tǒng)論文廣告推廣平臺代理
  • 國內(nèi)做賭博網(wǎng)站風(fēng)險大嗎鄭州千鋒教育培訓(xùn)機(jī)構(gòu)怎么樣
  • 網(wǎng)站備案怎樣提交到管局軟文廣告
  • 網(wǎng)站設(shè)計的銷售人工智能培訓(xùn)機(jī)構(gòu)
  • 南陽市住房和城市建設(shè)局網(wǎng)站seo搜索引擎排名優(yōu)化
  • 網(wǎng)站建設(shè)地址北京昌平關(guān)鍵詞搜索指數(shù)查詢工具
  • 網(wǎng)站集約化建設(shè)情況360推廣客服電話是多少
  • 詩敏家具網(wǎng)站是誰做的官網(wǎng)seo
  • h5網(wǎng)站建設(shè)文章淘寶指數(shù)查詢工具
  • wordpress mvc百度seo排名優(yōu)化提高流量
  • 深圳購物商城網(wǎng)站建設(shè)域名解析
  • 網(wǎng)站搜索排名高怎么做免費(fèi)百度下載
  • 自己怎么做交易網(wǎng)站網(wǎng)站里的友情鏈接
  • 發(fā)布網(wǎng)站需要備案交換鏈接營銷
  • 網(wǎng)站建設(shè)大作業(yè)選題怎樣制作一個網(wǎng)頁
  • 做電影解析網(wǎng)站獨(dú)立站谷歌seo
  • 網(wǎng)站建設(shè) 成功案例杭州專業(yè)seo服務(wù)公司