深色模式、首页设置页面和功能优化
This commit is contained in:
@@ -71,7 +71,7 @@ struct WidgetQuoteSettings {
|
||||
|
||||
async aboutToAppear() {
|
||||
try {
|
||||
const params = router.getParams() as RouterParams;
|
||||
const params = router.getState().params as RouterParams;
|
||||
console.info('[WidgetQuoteSettings] router params: ' + JSON.stringify(params));
|
||||
if (params && params.formName) {
|
||||
this.formName = params.formName;
|
||||
@@ -143,7 +143,7 @@ struct WidgetQuoteSettings {
|
||||
|
||||
async loadSettings() {
|
||||
try {
|
||||
const context = getContext(this);
|
||||
const context = getContext(this) as common.UIAbilityContext;
|
||||
this.preference = await preferences.getPreferences(context, 'widget_quote_settings');
|
||||
|
||||
this.selectedStyle = await this.preference.get('style', 'classic') as string;
|
||||
@@ -199,7 +199,7 @@ struct WidgetQuoteSettings {
|
||||
this.isSaving = true;
|
||||
try {
|
||||
if (!this.preference) {
|
||||
const context = getContext(this);
|
||||
const context = getContext(this) as common.UIAbilityContext;
|
||||
this.preference = await preferences.getPreferences(context, 'widget_quote_settings');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { router } from '@kit.ArkUI';
|
||||
import { preferences } from '@kit.ArkData';
|
||||
import { common } from '@kit.AbilityKit';
|
||||
//todo 重要 后续 刷新按钮要求固定显示
|
||||
@Entry
|
||||
@Component
|
||||
@@ -45,7 +46,7 @@ struct WidgetSettings {
|
||||
async saveSettings() {
|
||||
try {
|
||||
if (!this.preference) {
|
||||
const context = getContext(this);
|
||||
const context = getContext(this) as common.UIAbilityContext;
|
||||
this.preference = await preferences.getPreferences(context, 'widget_settings');
|
||||
}
|
||||
console.info('[WidgetSettings] Saving settings - showTime: ' + this.showTime + ', showWeather: ' + this.showWeather);
|
||||
|
||||
Reference in New Issue
Block a user