新聞中心
此操作實(shí)例指導(dǎo)你如何使用拆分應(yīng)用 Visual Studio 模板來(lái)創(chuàng)建博客閱讀應(yīng)用。

Important 此操作實(shí)例適用于 Microsoft Visual Studio 2012 和 Windows 8。 部分內(nèi)容在 Microsoft Visual Studio 2013 Preview 和 Windows 8.1 Preview 中可能無(wú)法正常運(yùn)行。
了解操作方法:
- 定義自己的 JSON 數(shù)據(jù)
- 使用 Windows.JS.xhr 檢索 RSS 數(shù)據(jù)
- 使用 PageControl 對(duì)象
- 在 ListView 中顯示數(shù)據(jù)
- 使用 AppBar 響應(yīng)命令
WindowsBlogReader
在本教程中,我們?yōu)槟承?Windows 團(tuán)隊(duì)博客創(chuàng)建了一個(gè)基本的閱讀器。完成后的應(yīng)用外觀如下所示:
該項(xiàng)頁(yè)面題為 "Windows 團(tuán)隊(duì)博客",并包含一個(gè) ListView 控件(每個(gè)博客一項(xiàng))。當(dāng)在 ListView 中單擊某項(xiàng)時(shí),可以導(dǎo)航到所選博客的拆分頁(yè)。該拆分頁(yè)包含一個(gè) ListView 控件(每篇博客文章一項(xiàng)),同時(shí)還包含一個(gè)控件用于縱向顯示當(dāng)前所選的博客文章的內(nèi)容。從拆分頁(yè)可以導(dǎo)航到項(xiàng)目詳細(xì)信息頁(yè)面,在詳細(xì)信息頁(yè)面中,博客文章的標(biāo)題顯示在頂部,當(dāng)前所選博客文章的內(nèi)容以水平方式顯示。
在 Visual Studio 中創(chuàng)建新項(xiàng)目
為我們的應(yīng)用創(chuàng)建一個(gè)名為 WindowsBlogReader 的新項(xiàng)目。以下是操作方法:
- 啟動(dòng) Visual Studio。
- 在“起始頁(yè)”選項(xiàng)卡中,單擊“新建項(xiàng)目”。隨即將打開(kāi)“新建項(xiàng)目”對(duì)話框。
- 在“已安裝”窗格中,展開(kāi) JavaScript 并選擇“Windows 應(yīng)用商店應(yīng)用”模板類(lèi)型。JavaScript 可用的項(xiàng)目模板隨即將顯示在對(duì)話框的中心窗格中。
- 在中心窗格中,選擇“拆分應(yīng)用”項(xiàng)目模板。
- 在“名稱(chēng)”文本框中,輸入 "WindowsBlogReader"。
- 單擊“確定”以創(chuàng)建項(xiàng)目。這需要花費(fèi)一點(diǎn)時(shí)間。
下面是在解決方案資源管理器中顯示的項(xiàng)目的結(jié)構(gòu)。頁(yè)面文件夾包含兩組文件,一組文件用于項(xiàng)頁(yè)面,另一組文件用于拆分頁(yè)面。這些組中的每個(gè)組為 PageControl、一組 HTML、CSS 以及 JavaScript 文件,這些文件定義應(yīng)用可以導(dǎo)航至或用作自定義控件的頁(yè)面。
新項(xiàng)目包含創(chuàng)建項(xiàng) PageControl 和拆分 PageControl 所需的 HTML、CSS 和 JavaScript 文件。稍后我們將為項(xiàng)詳細(xì)信息 PageControl 添加文件。
啟動(dòng)我們的新 Windows 應(yīng)用商店應(yīng)用
如果你非常想看到基本的分隔應(yīng)用的外觀,請(qǐng)按 F5 以生成、部署并啟動(dòng)應(yīng)用。應(yīng)用顯示為全屏頁(yè)面,標(biāo)題為 "WindowsBlogReader",包含一列示例項(xiàng)目,顯示為網(wǎng)格。每個(gè)項(xiàng)目表示一組數(shù)據(jù)。點(diǎn)擊或單擊列表中的項(xiàng)目以導(dǎo)航至拆分頁(yè)。拆分頁(yè)包含兩個(gè) 核心內(nèi)容區(qū)域。在左側(cè),你可以看到與所選組關(guān)聯(lián)的項(xiàng)目列表。在右側(cè),可以看到所選項(xiàng)目的內(nèi)容??梢酝ㄟ^(guò)點(diǎn)擊或單擊頁(yè)面上的“后退”按鈕來(lái)返回項(xiàng)目頁(yè)。
運(yùn)行應(yīng)用時(shí),應(yīng)用會(huì)提取 items.html 中的(或其中鏈接的)HTML、CSS 和 JavaScript,并將其注入到作為應(yīng)用起始頁(yè)的 default.html 頁(yè)面中。對(duì)于在應(yīng)用容器中運(yùn)行的代碼默認(rèn)可以執(zhí)行的操作有一些限制。例如,你的應(yīng)用不能訪問(wèn) Internet 或攝像頭,除非你聲明應(yīng)用需要此訪問(wèn)權(quán)限,且用戶(hù)在安裝應(yīng)用時(shí)授予了此訪問(wèn)權(quán)限。如需了解詳細(xì)信息,請(qǐng)打開(kāi) package.appxmanifest,并轉(zhuǎn)至“許可范圍”選項(xiàng)卡。
更改標(biāo)題和背景色
我們來(lái)執(zhí)行兩個(gè)簡(jiǎn)單的任務(wù)來(lái)自定義應(yīng)用。
若要更改應(yīng)用標(biāo)題,請(qǐng)打開(kāi) items.html,然后將 itemspage 中的 h1 元素文本替換為 "Windows 團(tuán)隊(duì)博客",如此處所示。
- Windows Team Blogs
若要設(shè)置應(yīng)用的背景色,請(qǐng)打開(kāi) default.css,并將此 background-color 屬性添加到 #contenthost 中。
- #contenthost {
- height: 100%;
- width: 100%;
- background-color: #0A2562;
- }
按 F5 來(lái)生成、部署并啟動(dòng)此應(yīng)用。請(qǐng)注意,項(xiàng)目頁(yè)的標(biāo)題已更改,項(xiàng)目頁(yè)和拆分頁(yè)的背景色為藍(lán)色。
Note項(xiàng)目中的 images 文件夾包含默認(rèn)的文件,系統(tǒng)將這些文件用于應(yīng)用啟動(dòng)時(shí)應(yīng)用的磁貼和初始屏幕。在本教程中,我們不更改這些內(nèi)容,但是你可以按照自己的喜好使用其他圖像。只 需將要使用的圖像文件添加到 images 文件夾中即可。打開(kāi) package.appxmanifest,將“應(yīng)用程序 UI”選項(xiàng)卡上“徽標(biāo)”、“小徽標(biāo)”和“初始屏幕”的內(nèi)容替換為你的圖像文件的路徑。
#p#
替換示例數(shù)據(jù)
項(xiàng)目模板包含運(yùn)行應(yīng)用時(shí)看到的示例數(shù)據(jù)。我們使用這些步驟為 Windows 團(tuán)隊(duì)博客將這些示例數(shù)據(jù)替換為來(lái)自 ATOM 源的數(shù)據(jù):
刪除示例數(shù)據(jù)
打開(kāi) data.js,其中包含應(yīng)用的示例數(shù)據(jù)。
我們不需要 generateSampleData 函數(shù),因此你可以將它刪除。
- // Returns an array of sample data that can be added to the application's
- // data list.
- function generateSampleData() {
- // Omitted code.
- }
我們不需要此代碼,所以你可以將其刪除:
- // TODO: Replace the data with your real data.
- // You can add data from asynchronous sources whenever it becomes available.
- generateSampleData().forEach(function (item) {
- list.push(item);
- });
設(shè)置變量和函數(shù)
將此代碼添加到 data.js(文件開(kāi)頭的 var list = new WinJS.Binding.List(); 聲明前面)。此代碼可設(shè)置我們所需的變量以及填充它們的函數(shù)。在執(zhí)行本教程中的步驟時(shí),你可以利用其中包含的注釋來(lái)找到每一步放置代碼的位置。
- // Set up array variables
- var dataPromises = [];
- var blogs;
- // Create a data binding for our ListView
- var blogPosts = new WinJS.Binding.List();
- // Process the blog feeds
- function getFeeds() {
- // Create an object for each feed in the blogs array
- // Get the content for each feed in the blogs array
- // Return when all asynchronous operations are complete
- }
- function acquireSyndication(url) {
- // Call xhr for the URL to get results asynchronously
- }
- function getBlogPosts() {
- // Walk the results to retrieve the blog posts
- }
- function getItemsFromXml(articleSyndication, bPosts, feed) {
- // Get the info for each blog post
- }
定義博客列表
為了使這個(gè)示例簡(jiǎn)單一點(diǎn),我們?cè)?blogs 數(shù)組中包含一列硬編碼的 URL。
將此代碼添加到 getFeeds 函數(shù)。此代碼將 JSON 數(shù)組添加到 blogs 數(shù)組。每個(gè) JSON 數(shù)組都包含多個(gè) JSON 對(duì)象,以存儲(chǔ)來(lái)自源的內(nèi)容。JSON 對(duì)象是名稱(chēng)/值對(duì)的未經(jīng)排序的容器。例如,博客標(biāo)題存儲(chǔ)在一個(gè) JSON 對(duì)象中,該對(duì)象名為 title,還有一個(gè)從 ATOM 源檢索的值。使用 JSON 對(duì)象使我們將來(lái)自源的內(nèi)容綁定到應(yīng)用的控件變得很簡(jiǎn)單。
- // Create an object for each feed in the blogs array
- blogs = [
- {
- key: "blog1",
- url: 'http://blogs.windows.com/skydrive/b/skydrive/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog2",
- url: 'http://blogs.windows.com/windows/b/windowsexperience/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog3",
- url: 'http://blogs.windows.com/windows/b/extremewindows/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog4",
- url: 'http://blogs.windows.com/windows/b/business/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog5",
- url: 'http://blogs.windows.com/windows/b/bloggingwindows/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog6",
- url: 'http://blogs.windows.com/windows/b/windowssecurity/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog7",
- url: 'http://blogs.windows.com/windows/b/springboard/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog8",
- url: 'http://blogs.windows.com/windows/b/windowshomeserver/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog9",
- url: 'http://blogs.windows.com/windows_live/b/developer/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog10",
- url: 'http://blogs.windows.com/ie/b/ie/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog11",
- url: 'http://blogs.windows.com/windows_phone/b/wpdev/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- },
- {
- key: "blog12",
- url: 'http://blogs.windows.com/windows_phone/b/wmdev/atom.aspx',
- title: 'tbd', updated: 'tbd',
- acquireSyndication: acquireSyndication, dataPromise: null
- }];
#p#
檢索源數(shù)據(jù)
對(duì)于此部分中的步驟,我們使用適用于 JavaScript 的 Windows 庫(kù)來(lái)管理聯(lián)合源。
將此代碼添加到 acquireSyndication 函數(shù)。我們調(diào)用 Windows.JS.xhr 函數(shù)以檢索源內(nèi)容。此調(diào)用為異步調(diào)用。幸運(yùn)的是,程序已經(jīng)為我們處理好了在進(jìn)行異步調(diào)用時(shí)可能會(huì)遇到的許多復(fù)雜問(wèn)題。xhr 返回時(shí),我們將收到結(jié)果的承諾,此承諾將返回到調(diào)用方。
- // Call xhr for the URL to get results asynchronously
- return WinJS.xhr(
- {
- url: url,
- headers: { "If-Modified-Since": "Mon, 27 Mar 1972 00:00:00 GMT" }
- });
現(xiàn)在,我們將代碼添加到 getFeeds 函數(shù)以調(diào)用 blogs 數(shù)組中每個(gè)博客的 acquireSyndication 函數(shù),并添加返回到我們 promise 數(shù)組的 promise dataPromises。我們先調(diào)用 WinJS.Promise.join 函數(shù),等待所有承諾均已滿(mǎn)足后,再?gòu)?getFeeds 返回。這可以確保在顯示 ListView 控件之前,我們擁有全部所需的信息。
- // Get the content for each feed in the blogs array
- blogs.forEach(function (feed) {
- feed.dataPromise = feed.acquireSyndication(feed.url);
- dataPromises.push(feed.dataPromise);
- });
- // Return when all asynchronous operations are complete
- return WinJS.Promise.join(dataPromises).then(function () {
- return blogs;
- });
接下來(lái),將此代碼添加到 getBlogPosts 函數(shù)。對(duì)于 blogs 數(shù)組中的每個(gè)博客,我們針對(duì)所需的信息分析 XML 源數(shù)據(jù)。首先,我們使用 responseXML 屬性以獲得響應(yīng)正文,然后使用 querySelector 方法以及所需的選擇器來(lái)獲得博客的標(biāo)題和最后更新日期。我們使用 Windows.Globalization.DateTimeFormatting.DateTimeFormatter 來(lái)轉(zhuǎn)換顯示的上次更新日期。
如果 articlesResponse.responseXML 是 null,則說(shuō)明加載博客時(shí)出錯(cuò),因此我們會(huì)在博客發(fā)布位置顯示一條錯(cuò)誤消息。
- // Walk the results to retrieve the blog posts
- getFeeds().then(function () {
- // Process each blog
- blogs.forEach(function (feed) {
- feed.dataPromise.then(function (articlesResponse) {
- var articleSyndication = articlesResponse.responseXML;
- if (articleSyndication) {
- // Get the blog title
- feed.title = articleSyndication.querySelector("feed > title").textContent;
- // Use the date of the latest post as the last updated date
- var published = articleSyndication.querySelector("feed > entry > published").textContent;
- // Convert the date for display
- var date = new Date(published);
- var dateFmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter(
- "month.abbreviated day year.full");
- var blogDate = dateFmt.format(date);
- feed.updated = "Last updated " + blogDate;
- // Get the blog posts
- getItemsFromXml(articleSyndication, blogPosts, feed);
- }
- else {
- // There was an error loading the blog.
- feed.title = "Error loading blog";
- feed.updated = "Error";
- blogPosts.push({
- group: feed,
- key: "Error loading blog",
- title: feed.url,
- author: "Unknown",
- month: "?",
- day: "?",
- year: "?",
- content: "Unable to load the blog at " + feed.url
- });
- }
- });
- });
- });
- return blogPosts;
最后,將此代碼添加到 getItemsFromXml 函數(shù)。首先,我們使用 querySelectorAll 來(lái)獲得博客文章集以及每篇博客文章的信息。然后,我們使用 querySelector 來(lái)獲得每篇博客文章的信息。我們使用 Windows.Globalization.DateTimeFormatting.DateTimeFormatter 來(lái)轉(zhuǎn)換顯示的上次更新日期。最后,我們使用 push 方法將每篇博客文章的信息存儲(chǔ)在 bPosts 數(shù)組中的相應(yīng)條目中。
- // Get the info for each blog post
- var posts = articleSyndication.querySelectorAll("entry");
- // Process each blog post
- for (var postIndex = 0; postIndex < posts.length; postIndex++) {
- var post = posts[postIndex];
- // Get the title, author, and date published
- var postTitle = post.querySelector("title").textContent;
- var postAuthor = post.querySelector("author > name").textContent;
- var postPublished = post.querySelector("published").textContent;
- // Convert the date for display
- var postDate = new Date(postPublished);
- var monthFmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter(
- "month.abbreviated");
- var dayFmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter(
- "day");
- var yearFmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter(
- "year.full");
- var blogPostMonth = monthFmt.format(postDate);
- var blogPostDay = dayFmt.format(postDate);
- var blogPostYear = yearFmt.format(postDate);
- // Process the content so it displays nicely
- var staticContent = toStaticHTML(post.querySelector("content").textContent);
- // Store the post info we care about in the array
- bPosts.push({
- group: feed,
- key: feed.title,
- title: postTitle,
- author: postAuthor,
- month: blogPostMonth.toUpperCase(),
- day: blogPostDay,
- year: blogPostYear,
- content: staticContent
- });
- }
#p#
使數(shù)據(jù)可用
現(xiàn)在,我們已完成了將源數(shù)據(jù)存儲(chǔ)到數(shù)組中的代碼,我們需要按照 ListView 控件的預(yù)期來(lái)對(duì)源數(shù)據(jù)進(jìn)行分組。我們還需要完成將源數(shù)據(jù)綁定到 ListView 控件這一任務(wù)。
getItemsFromGroup 函數(shù)調(diào)用 createFiltered 方法,并返回指定博客的博客文章。getItemsFromGroup 函數(shù)依賴(lài)變量 list。
- var list = new WinJS.Binding.List();
將此定義替換為對(duì) getBlogPosts 函數(shù)的調(diào)用,該函數(shù)返回 blogPosts 變量。這是一個(gè) WinJS.Binding.List 對(duì)象。
- var list = getBlogPosts();
注意,調(diào)用 createGrouped 方法將按指定的鍵(此情況中是指每篇文章所屬的博客)對(duì)博客文章排序。
- var groupedItems = list.createGrouped(
- function groupKeySelector(item) { return item.group.key; };
- function groupDataSelector(item) { return item.group; }
更新項(xiàng) PageControl
項(xiàng) PageControl 的主要功能是使用 WinJS.UI.ListView 實(shí)現(xiàn)的 ListView 控件。每個(gè)博客在此列表中都有一個(gè)項(xiàng)目。讓我們修改模板中提供的 ListView 項(xiàng),以包含博客標(biāo)題和上次更新博客的日期。
打開(kāi) items.html。我們需要更新此 div 標(biāo)記中的 HTML,從而在我們的 blogs 數(shù)組中反映內(nèi)容。
進(jìn)行以下更新:
- 因?yàn)椴皇敲總€(gè)博客都有圖像,因此請(qǐng)刪除 img 標(biāo)記。
- 在 h6 標(biāo)記中,將
textContent: subtitle更新為textContent: updated。這會(huì)在 ListView 項(xiàng)目的覆蓋部分中放置上次更新日期。 - 移動(dòng)位于類(lèi)
item-overlay的 div 之前的 h4 標(biāo)記。這會(huì)在 ListView 項(xiàng)目的主要部分中放置博客標(biāo)題。
結(jié)果如下所示。
若要將列表項(xiàng)目的顏色設(shè)置為淺藍(lán)色,請(qǐng)打開(kāi) items.css 并添加此處所示的 background-color 屬性。此外,在 -ms-grid-rows 屬性中將第二行的大小從 90px 更改為 60px,如此處所示,因?yàn)槲覀冎伙@示覆蓋中的上次更新日期。
- .itemspage .itemslist .item {
- -ms-grid-columns: 1fr;
- -ms-grid-rows: 1fr 60px;
- display: -ms-grid;
- height: 250px;
- width: 250px;
- background-color: #557EB9;
- }
若要為博客標(biāo)題設(shè)置字體大小和邊距,請(qǐng)將此代碼添加到 items.css。
- .itemspage .itemslist .win-item .item-title {
- -ms-grid-row: 1;
- overflow: hidden;
- width: 220px;
- font-size: 24px;
- margin-top: 12px;
- margin-left: 15px;
- }
更新拆分 PageControl
打開(kāi) split.html。模板中拆分頁(yè)的 HTML 使用與示例數(shù)據(jù)相同的名稱(chēng)。我們需要更新此 div 標(biāo)記中的 HTML,從而在我們的 blogPosts 數(shù)組中反映名稱(chēng)。
進(jìn)行以下更新:
- 將 img 標(biāo)記替換為新的 ...節(jié)點(diǎn)。
- 在 h6 標(biāo)記中,將 textContent: subtitle 改為 textContent: author。
- 刪除 h4 標(biāo)記
結(jié)果如下所示。
- |
注意,我們將管道字符用作分隔符,因?yàn)?HTML 不包含用于繪制豎線的標(biāo)記。
因?yàn)槲覀儧](méi)有包含在示例數(shù)據(jù)中的所有信息,所以從 articleSection 刪除此代碼可以簡(jiǎn)化頁(yè)面。
#p#
若要設(shè)置文本塊的顏色以及文本的項(xiàng)目日期、字體和邊距,請(qǐng)打開(kāi) split.css 并添加此代碼。
- .splitpage .itemlistsection .itemlist .item .item-date {
- -ms-grid-column: 1;
- background-color: #557EB9;
- }
- .splitpage .itemlistsection .itemlist .item .item-date .item-month{
- margin-top: 12px;
- margin-left: 12px;
- margin-bottom: 4px;
- font-weight: bold;
- font-size: 28px;
- }
- .splitpage .itemlistsection .itemlist .item .item-date .item-day{
- margin-left: 12px;
- font-size: 28px;
- }
若要獲取我們所需的頁(yè)面布局,請(qǐng)將此 -ms-grid-row 屬性從 "1" 改為 "2"。這導(dǎo)致頁(yè)面標(biāo)題填滿(mǎn)整個(gè)第一行,并且將 ListView 和文章放在第二行。
- .splitpage .articlesection {
- -ms-grid-column: 2;
- -ms-grid-row: 2;
- -ms-grid-row-span: 2;
- margin-left: 50px;
- overflow-y: auto;
- padding-right: 120px;
- position: relative;
- z-index: 0;
- }
現(xiàn)在,來(lái)試試再次運(yùn)行應(yīng)用吧。按 F5 可構(gòu)建、部署并啟動(dòng)此應(yīng)用??梢粤⒓纯吹巾?yè)面標(biāo)題,但是應(yīng)用檢索源數(shù)據(jù)時(shí)有短暫的延遲。滿(mǎn)足所有承諾后,可以看到在 ListView 中每個(gè)博客一個(gè)項(xiàng)。(此代碼以滿(mǎn)足承諾的順序?qū)⑦@些項(xiàng)添加到 ListView 中。)點(diǎn)擊或單擊 ListView 中的項(xiàng)會(huì)將你帶到拆分頁(yè),此拆分頁(yè)包含所選博客的博客文章列表以及所選博客文章的內(nèi)容。默認(rèn)選中第一篇博客文章。
單擊“后退”箭頭可返回到項(xiàng)頁(yè)。請(qǐng)注意,返回到屏幕的磁貼帶有過(guò)渡動(dòng)畫(huà)。這是 Windows JavaScript 庫(kù)中的一個(gè)功能,它支持控件以及其他用戶(hù)界面元素按照 Windows 應(yīng)用商店應(yīng)用的 UX 指南移動(dòng)。
添加項(xiàng)詳細(xì)信息 PageControl
項(xiàng)詳細(xì)信息 PageControl 將博客文章的標(biāo)題顯示為自己的標(biāo)題,并有一塊區(qū)域包含博客文章的內(nèi)容。
添加項(xiàng)詳細(xì)信息 PageControl 的步驟:
- 在解決方案資源管理器中,右鍵單擊 pages 文件夾,選擇“添加”>“新建文件夾”。
- 將該文件夾命名為 itemDetail。
- 在解決方案資源管理器中,右鍵單擊 itemDetail 文件夾,選擇“添加”>“新建項(xiàng)”。
- 選擇“JavaScript”>“Windows 應(yīng)用商店”>“頁(yè)面控件”,然后使用文件名 itemDetail.html。
- 單擊“添加”以在 pages/itemDetail 文件夾中創(chuàng)建 itemDetail.css、itemDetail.html 和 itemDetail.js 文件。
打開(kāi) itemDetail.html 并更新此處所示的主要部分。此代碼定義頁(yè)面布局。(這是網(wǎng)格應(yīng)用模板中包含的 itemDetail.html 頁(yè)面代碼的簡(jiǎn)化版本。)
itemDetail
- <
新聞名稱(chēng):操作實(shí)例:創(chuàng)建博客閱讀器(JavaScript 和 HTML)
當(dāng)前URL:http://www.dlmjj.cn/article/dhsoeig.html


咨詢(xún)
建站咨詢(xún)
